Question
static void Main(string[] args)
{
int i = 1234 ,j = 0;
/*ADD CODE HERE */
Console.WriteLine(j);
}
a.
do
{
j = j + (i % 10);
}while ((i = i / 10)!= 0);
b.
do
{
j = j + (i % 10);
}while ((i / 10)!= 0);
c.
do
{
j = j + (i % 10);
}while ((i % 10)!= 0);
d.
do
{
j = j + (i % 10);
}while ((i/10 == 0)!= 0);
Posted under C# programming
{
j = j + (i % 10);
}while ((i = i / 10)!= 0);
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. For the incomplete program below, which of the code fragment will not result in an infinite loop:
Similar Questions
Discover Related MCQs
Q. Which of the following is not infinite loop?
View solution
Q. Which statement is correct among the mentioned statements?
1. The for loop works faster than a while loop
2. for( ; ; )implements an infinite loop
View solution
Q. Which of the following statements are correct?
1. A switch statement can act on numerical as well as Boolean types.
2. A switch statement can act on characters, strings and enumerations types.
3. We cannot declare variables within a case statement if it is not enclosed by { }.
4. The foreach statement is used to iterate through the collection to get the desired information and should be used to change the contents of the collection to avoid unpredictable side effects.
5. All of the expressions of the for statement are not optional.
View solution
Q. Which of the following is the incorrect form of Decision Control instruction?
View solution
Q. Which of the following statements is correct?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!
Operating System
Dive deep into the core of computers with our Operating System MCQs. Learn about...
Software Engineering
Learn about the systematic approach to developing software with our Software...