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 sum of its digit with using control
structure or with out using loop. for ex: let the number is
25634 then answer will be=2+5+6+3+4=20

Answer Posted / rama krishna sidhartha

#include <stdio.h>
#include<conio.h>
void main()
{
int s=0,c,n;
clrscr();
printf("\n ENTER A VALUE : ");
scanf("%d",&n);
while(n>0)
{
c=n%10;
s=s+c;
n=n/10;
}
printf("\n THE SUM OF INDIVIDUAL DIGITS : %d",s);
getch();
}

Is This Answer Correct ?    10 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by command line argument?

1154


In a header file whether functions are declared or defined?

1117


Give differences between - new and malloc() , delete and free() ?

1079


What is the difference between if else and switchstatement

1918


What is the use of ?

1025


Explain the difference between #include "..." And #include <...> In c?

1014


Is it possible to have a function as a parameter in another function?

1062


What are the types of variables in c?

1003


What is derived datatype in c?

1071


How can you determine the size of an allocated portion of memory?

1287


How can I sort a linked list?

1030


What is conio h in c?

1034


What is typedef struct in c?

1031


How can this be legal c?

1075


What is the purpose of macro in C language?

1102