How to print square and cube of value?

CODE




How to print square and cube of value?
Program to print square and cube of each value up to N

int main()
{
        int i,n;
        printf("\n enter the number:");
        scanf("%d",&n);
        printf("\n num --> square,cube");
        for(i=1;i<=n;i++)
            printf("\n %d   -->   %d   , %d",i,i*i,i*i*i);
}


Output:
enter the number: 4

 num --> square,cube
 1   -->   1   , 1
 2   -->   4   , 8
 3   -->   9   , 27
 4   -->   16   , 64

How to print square and cube of value? How to print square and cube of value? Reviewed by Unknown on December 15, 2018 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.