Friday, October 26, 2018

Uri 1142 solution in C | PUM

/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/


#include <stdio.h>
int main()
{
    int N, a,b,c=1,d=4;
    scanf("%d", &N);
    for(a=1;a<=N;a++)
    {
        for(b=c;b<=d;b++)
        {
            if(b%4==0)
                printf("PUM\n");
            else
                printf ("%d ",b);
        }
        c+=4; d+=4;
    }
    return 0;
}

 //Happy_Coding

No comments:

Post a Comment