本文介绍了for循环C#中的商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您好。 这是一个功课,所以不要给我答案。 IM将执行一个程序,在分子和分母中从1 -100查看每个分子和分母,商数为= 5,然后分子和分母将在屏幕上输出。 int num1,num2; for (num1 = 1 ; num1 < ; = 101 ; num1 ++) { for (num2 = 1 ; num2 < = 101 ; num2 ++) { if (num1 + num2 == 101 ) Console.WriteLine(num1 + / + num2); } } Console.ReadLine(); } } } 这就是我所做的。只需要显示denominatorf的商数为1- 100. 我知道我需要输入一个新的int然后在if中计算= 5但我真的不知道该怎么做任何人都可以帮助我。 对不起英文不好解决方案 Hello.This is a homework so don''t give me the answer.IM going to do a program that look in to every numerator and denominator from 1 -100 in both numerator and denominatorf the quotient is = 5 then the numerator and denominatorf will be typed out on the screen. int num1, num2; for (num1 = 1; num1 <= 101; num1++) { for (num2 = 1; num2 <= 101; num2++) { if (num1 + num2 == 101) Console.WriteLine(num1 + " / " + num2); } } Console.ReadLine(); } }}this is what i have done. Only geting to show denominatorf the quotient to 1- 100. I know that i need to put in a new int and then count out the = 5 in the if but i dont really know how to do it can any one help me whit it. Sorry for the bad english 解决方案 这篇关于for循环C#中的商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-22 16:47