Header Ads

Header ADS

Solution of URI 1143::Squared and Cubic

Before seeing the solution make sure that you have tried enough. Don’t copy the whole code, just find out the logic. If you feel any problemyou will inform me by comment.




#include <stdio.h>

int main()
{
    int N,i;
    long int N2,N3;

    while(scanf("%d",&N) !=EOF) {

    for(i=1;i<=N;i++) {
        N2=i*i;
        N3=i*i*i;
        printf("%d %ld %ld\n",i,N2,N3);
    }
  }

    return 0;
}

No comments

Theme images by konradlew. Powered by Blogger.