Answer to Question #300008 in C for please!

Question #300008

The first line will contain a message prompt to input the integer.

The succeeding lines contain the odd numbers.

Enter·n:·10
9
7
5
3
1
1
Expert's answer
2022-02-19T16:56:12-0500
#include <stdio.h>

int main()
{
   int n;
   printf("Enter n: ");
   scanf("%d", &n);
   while(n > 0) {
       if (n % 2 == 1)
           printf("%d\n", n);
       n--;
   }

   return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS