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...

if a five digit number is input through the keyboard, write
a program to calculate the sum of its digits.
(hint:-use the modulus operator.'%')

Answer Posted / nishant rai

#include<stdio.h>
#include<conio.h>
void main()
{
int num=0,sum=0,k=0;
pirntf("enter the number\n");
scanf("%d",num);
while(num!=0);
{
k=num%10;
sum=sum+k;
num=num/10;
}
printf("%d",sum);
getch();
}

Is This Answer Correct ?    13 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you tell whether two strings are the same?

1265


hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..

1925


Tell us two differences between new () and malloc ()?

1209


In a header file whether functions are declared or defined?

1133


Is that possible to store 32768 in an int data type variable?

1093


What is meant by realloc()?

1165


What is volatile variable in c with example?

1050


How can I read data from data files with particular formats?

1052


A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor

1108


Write a code to remove duplicates in a string.

1049


Write a C program in Fibonacci series.

1098


What are the properties of union in c?

1056


pierrot's divisor program using c or c++ code

2247


What is n in c?

1070


What is pragma in c?

1222