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 sizeof int in c?

1060


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

1126


What are type modifiers in c?

1054


what do you mean by inline function in C?

1058


What is the meaning of typedef struct in c?

1072


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

1174


What does %p mean c?

1073


Explain which function in c can be used to append a string to another string?

1092


What is the use of parallelize in spark?

1030


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1531


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1725


What is string function in c?

986


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

1068


what is the role you expect in software industry?

2153


What is optimization in c?

1012