How to write program to print descending order

Questions by RoshanAshsih

Showing Answers 1 - 3 of 3 Answers

Here is a program to print first n odd numbers in descending order

#include
main()
{
int i=0,j=0,n;
printf("Enter a number:");
scanf("%d",&n);
printf("The first %d odd numbers are:-
");
for(i=0;i<=n;i++)
{
if(j%2!=0)
printf("%d
"j);
j=j+1;
}
}

Bhushan

  • Apr 6th, 2015
 

Code
  1. #include

  2. "Enter a number:");

  3. scanf("%d""The first %d odd numbers are:-

  4. ""%d"j);

  5. }

  6. }
Code
  1. #include

  2. "Enter a number:");

  3. scanf("%d""The first %d odd numbers are:-

  4. ""%d"i);

  5. }

  6. }

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions