URI Online Judge Solution 1142 PUM using C Programming Language.
Write a program that reads an integer N. This N is the number of output lines printed by this program.
Input
The input file contains an integer N.
Output
Print the output according to the given example.
Input Sample | Output Sample |
7
|
1 2 3 PUM
5 6 7 PUM 9 10 11 PUM 13 14 15 PUM 17 18 19 PUM 21 22 23 PUM 25 26 27 PUM |
Solution using C :
#include <stdio.h>
int main() {
int N,i,j,p=1;
scanf("%d",&N);
for(i=1; i<=N; i++)
{
for(j=1; j<=3; j++)
{
printf("%d ",p++);
}
p++;
printf("PUM\n");
}
return 0;
}
Comments
Post a Comment