URI - BEECROWD - BEE 1146 - Growing Sequences - Solution in C,C++,Python,JavaScript
beecrowd | 1146
Growing Sequences
Adapted by Neilor Tonin, URI Brazil
Timelimit: 1URI / BEE CROWD 1146 - Growing Sequences - Solution in C,C++,Python,JavaScript:
Your program must read an integer X indefinited times (the program must stop when X is equal to zero). For each X print the sequence from 1 to X, with one space between each one of these numbers.
PS: Be carefull. Don't leave any space after the last number of each line, otherwise you'll get Presentation Error.
Your program must read an integer X indefinited times (the program must stop when X is equal to zero). For each X print the sequence from 1 to X, with one space between each one of these numbers.
PS: Be carefull. Don't leave any space after the last number of each line, otherwise you'll get Presentation Error.
Input
The input file contains many integer numbers. The last one is zero.
The input file contains many integer numbers. The last one is zero.
Output
For each number N of the input file, one output line must be printed, from 1 to N like the following example. Be careful with blank spaces after the last line number.
For each number N of the input file, one output line must be printed, from 1 to N like the following example. Be careful with blank spaces after the last line number.
Input Sample | Output Sample |
5 | 1 2 3 4 5 |
URI / BEE 1146 Solution in C :
URI / BEECROWD Online Judge 1146 Solve in C : |
#include <stdio.h>
int main()
{
int a,b;
while(1)
{
scanf("%d", &a);
if(a==0) break;
else
{
for(b=1; b<a; b++)
printf("%d ",b);
}
printf("%d\n",a);
}
return 0;
}
0 Response to URI / BEE CROWD 1146 - Growing Sequences - Solution in C,C++,Python,JavaScript
Post a Comment