N. Loop
Problem link
https://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/N
Score: 1
CPU: 1s
Memory: 512MB
CPU: 1s
Memory: 512MB
Given
Suppose
n
, you have to print n
to 1
.Suppose
n = 5
. Then you have to print 5, 4, 3, 2, 1
.
Input
You will be given a positive integer
You will be given a positive integer
n (1<=n<=1000)
.
Output
You have to print from
You have to print from
n
to 1
in n lines. Please see the sample i/o for better understanding.Sample
Input | Output |
---|---|
5 | 5 4 3 2 1 |
Solution
#include<stdio.h> int main() { int n,i; scanf("%d",&n); if(n>=1 && n<=1000){ for(i=n;i>=1;i--){ printf("%d\n",i); } } return 0; }
No comments:
Post a Comment