Tuesday, October 06, 2015

Write a program to display the series: 1, 8, 27, up to 10th term using for loop.

Solution:-
    #include<conio.h>
    #include<stdio.h>
    void main ( )
    {
            clrscr( ) ;
            int term,cube;
            printf(" Display the series 1, 8, 27, 64,  ........ up to 10th term : \n");
            for(term=1;term<=10;term++)
            {
                   cube=term*term*term;
                   printf("%d\t",cube);
            }
            getch( );
    }