Brijmohan lal Sahu - Facebook
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Sunday, December 7, 2014

Program to calculate sum of cubic series using while loop without power function in C.


cubic series sum using while loop


Code Box
--------------------------------------------

/*program to calculate sum of the series 
(1*1*1)+(2*2*2)+(3*3*3)+(4*4*4)+.......+(n*n*n).
cube number series. 
without using power function.
where n is the limit entered by user.
*/

#include<stdio.h>
#include<conio.h>
void main()
{
int i,sum,num;

clrscr();

sum=0;

printf("\nEnter limit : ");
scanf("%d",&num);

printf("\nCubic Number Series ");

printf("\nSeries= ");

i=1;           //initialization

while(i<=num)
{
sum=sum+(i*i*i);
printf("+ (%d*%d*%d)",i,i,i);

i++;           //increment post fix operator 

}

printf("\n\nSum of series= %d",sum);

getch();
}