URI Online Judge | 1142
PUM
Adapted by Neilor Tonin, URI  Brazil
 Brazil
Timelimit: 1 Brazil
 Brazil
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 | 
URI Online Judge Solution 1142 || PUM in Java Language
import java.io.IOException;import java.util.Scanner;public class Main {    public static void main(String[] args) throws IOException {        int N;        Scanner input = new Scanner(System.in);        N = input.nextInt();        for (int i = 1; i <= (4*N - 1); i+=4) {            for (int j = i; j <= i+2; j++) {                System.out.print(j+" ");            }            System.out.print("PUM\n");        }    }}URI Online Judge Solution 1142 || PUM in C Language
#include<stdio.h>
int main(){
        int N, i, j;
        scanf("%d", &N);
        for (i = 1; i <= (4*N - 1); i+=4) {
            for (j = i; j <= i+2; j++) {
                printf("%d ", j);
            }
            printf("PUM\n");
        }
}Download code from Dropbox
URI Question Main Link

No comments:
Write commentsTo know more about the problem, give us your valuable commment. We'll try to help you. Thanks