Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to gat the digt sum of a number (et. 15=
>1+5=6)

Answer Posted / sagarsp2010

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0,no;
clrscr();

printf("ENTER THE NO. OF TERMS:");
scanf("%d",&n);

for (i=1;i<=5;i++)
{

no=n%10;
sum=sum+no;
n=n/10;

}
printf("sum=%d",sum);

getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between printf and scanf in c?

1430


Is c a great language, or what?

1166


Explain the difference between malloc() and calloc() in c?

1104


Difference between strcpy() and memcpy() function?

1217


What is the use of define in c?

1103


Explain what is a 'locale'?

1131


Why do we need a structure?

1082


What is the value of uninitialized variable in c?

1088


what are the 10 different models of writing an addition program in C language?

1945


what is the role you expect in software industry?

2202


What are external variables in c?

1168


What are the disadvantages of c language?

1257


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1994


How does sizeof know array size?

1172


Where are the auto variables stored?

1210