Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

C - VERY-EASY - PART004-Reverse Order - Print N to 1

 A number N is passed as the input. The program must print the numbers from N to 1 (inclusive of N).


Input Format:

The first line denotes the value of N


Output Format:

Numbers from N to 1, with each number separated by a space.


Boundary Conditions:

1 < N <= 1000


Example Input/Output 1:

Input:

5


Output:

5 4 3 2 1


Example Input/Output 2:

Input:

10


Output:

10 9 8 7 6 5 4 3 2 1

CODE:

 #include<stdio.h>

#include<stdlib.h>

int main()

{int a;

scanf("%d",&a);

for(int i=a;i>=1;i--)

{

    printf("%d ",i);

}

}

Post a Comment

Previous Post Next Post