Pages

Friday, 19 April 2013


Sum Through while loop:

#include<stdio.h>
#include<conio.h>
int main()
{
    int a,b,sum,totalsum,num=1;
   printf("enter the a\n");
    scanf("%d",&a);
     printf("enter the b\n");
    scanf("%d",&b);
   // printf("the sum is %d\n",sum);
    do
    {
    
    sum=a+b;
    totalsum=totalsum+num;
    num++;}
    while(num<=10);
    printf("sum is %d",totalsum);
    
getch();
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *