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 'c' program to sum the number of integer values

Answer Posted / ruchi

#include<stdio.h>
#include<conio.h>
int main()
{
int n,m,m1,s=0,d,sum;
printf("\nEnter the number ");
scanf("%d",&n);
m=n%10;
d=n/10;
while(d>=10)
{
m1=d%10;
d=d/10;
s =s+m1;
}
sum=s+m+d;
printf("\nSum is %d",sum);
getch();
}

Is This Answer Correct ?    4 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the uses of null pointers?

1029


Is null always equal to 0(zero)?

988


Explain what is the difference between a free-standing and a hosted environment?

1125


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

1013


Explain about block scope in c?

1029


What is an example of structure?

976


Explain how can a program be made to print the name of a source file where an error occurs?

1133


How can I find the modification date and time of a file?

1022


Who is the main contributor in designing the c language after dennis ritchie?

949


write a program to copy the string using switch case?

2840


Difference between malloc() and calloc() function?

1126


Explain what is output redirection?

1132


Can a program have two main functions?

1055


why we wont use '&' sing in aceesing the string using scanf

2308


What is spaghetti programming?

1069