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

void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1664


Can an array be an Ivalue?

1051


Explain what is output redirection?

1133


can anyone please tell about the nested interrupts?

2063


Write a program in c to replace any vowel in a string with z?

1070


Which one would you prefer - a macro or a function?

1031


Is return a keyword in c?

1028


Explain the difference between the local variable and global variable in c?

1021


Write a C program to count the number of email on text

1851


What is the ANSI C Standard?

1208


How can I open a file so that other programs can update it at the same time?

1126


What is dangling pointer in c?

1126


What are the advantages of c language?

1038


Write a function that will take in a phone number and output all possible alphabetical combinations

997


the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

1195