#include<stdio.h> #include<conio.h> void main() { int a,i,sum=0; clrscr(); printf("enter a range:"); scanf("%d",&a); i=1; while(i<=a) { sum=sum+i*i*i; i++; } printf("the sum of the Qube natural no is:=%d\n",sum); getch(); } |
Output:-
Explanation:-
The Number is :3 (1 + 2 + 3 )
Qube of (1*1*1+2*2*2+3*3*3) = 1 + 8 + 27 =36.
______________________________________________________
______________________________________________________
______________________________________________________
______________________________________________________
_____________________________________________________
Post a Comment