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 / revanth kumar.p

include<stdio.h>
#include<conio.h>
int main()
{
int num,len = 1,a,b;
printf("Enter a number");
scanf("%d",&num);
while(num >= 10)
{
num = num/10;
len++;
}
printf("%d",len);
a=len;
a=len*(len+1)%2;
printf("\n%d",a);
b=len;
b=len*(len+1)/2;
printf("\n%d",b);
a=a+b;
printf("\n%d",a);


getch();

}

Is This Answer Correct ?    4 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is #error and use of it?

1194


What is dangling pointer in c?

1126


Write a program to know whether the input number is an armstrong number.

1071


What is calloc in c?

1075


What is the basic structure of c?

1008


What is the scope of global variable in c?

947


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

1055


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

2275


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1093


What does typedef struct mean?

1038


How do I copy files?

993


Can we increase size of array in c?

917


Why string is used in c?

952


What does 3 periods mean in texting?

1007


Is c procedural or functional?

977