Friday, October 26, 2018

Uri 1144 solution in C | Logical Sequence

/*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>
main()
{
    int i,a,b,c,n,x,y,z;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        a=i;
        b=i*i;
        c=i*i*i;
        x=b+1;
        y=c+1;
        printf("%d %d %d\n%d %d %d\n",i,b,c,a,x,y);

    }
    return 0;
}

 //Happy_Coding

No comments:

Post a Comment