Home > Back-end >  I want to ask me what wrong, I didn't see that
I want to ask me what wrong, I didn't see that

Time:10-31

#include

Int main () {
Topic name: conform to the conditions of natural number

Title description: write a program to print all less than positive integer data and natural number is divisible by 11,



Data input: input from the keyboard a positive integer

All output: the output less than the natural number of data and can be divided exactly by 11, with a space between number and interval, no redundant character after the last number,

Int a, I, c;

The scanf (" % d ", & amp; A);

for(i=1; i
If (I % 11==0)

Printf (" % d ", I);

Printf (" "); }

C=I;

C=c % 11;

If (c==0)

Printf (" % d ", c);

The else return 0;

}

CodePudding user response:

A less than positive integer
Your for loop for (I=1; i
Is less than the example of a - 1 input the last number was 111, 110 of your cycle is less 110
Change: the for (I=1; i CodePudding user response:

 
#include

Int main ()
{
/*
Topic name: conform to the conditions of natural number

Title description: write a program to print all less than positive integer data and natural number is divisible by 11,



Data input: input from the keyboard a positive integer

All output: the output less than the natural number of data and can be divided exactly by 11, with a space between number and interval, no redundant character after the last number,
*/

/*
Int a, I, c;

The scanf (" % d ", & amp; A);

//for (I=1; i
for(i=1; i
If (I % 11==0)

Printf (" % d ", I);

Printf (" ");
}

C=I;

C=c % 11;

If (c==0)

Printf (" % d ", c);

The else
*/
The int data, I;

The scanf (" % d ", & amp; The data);

For (I=0; i If (I % 11==0) {
if (i !=0)
Printf (" ");
Printf (" % d ", I);
}
}
return 0;

}

For your reference ~

Natural number should start from zero
  • Related