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

FILE PROGRAMMING

2248


How many levels of indirection in pointers can you have in a single declaration?

1094


Does c have function or method?

1010


When should a far pointer be used?

1140


In a byte, what is the maximum decimal number that you can accommodate?

1143


What is the use of gets and puts?

1036


What is c mainly used for?

1070


Explain what is the difference between text files and binary files?

1166


What is oops c?

1259


Function calling procedures? and their differences? Why should one go for Call by Reference?

1092


Explain bit masking in c?

1145


Write a program to reverse a linked list in c.

1141


What is the difference between strcpy() and memcpy() function in c programming?

1096


Can we compile a program without main() function?

1132


What is #include stdlib h?

1112