DO NOT MISS

Ads

Sunday, 31 July 2016

Program 16 Using While loop


#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.
______________________________________________________
______________________________________________________
______________________________________________________

_____________________________________________________



Greataims

 
Copyright © 2016 Computersadda. Designed by @ Computersadda Team - Published By Greataims