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 does the characters “r” and “w” mean when writing programs that will make use of files?

1492


Is it cc or c in a letter?

1041


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

2197


Is c call by value?

1033


Can the “if” function be used in comparing strings?

1065


What is the process to create increment and decrement stamen in c?

1073


What is the difference between char array and char pointer?

1074


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

1176


Tell me the use of bit field in c language?

1078


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

1928


Can you please explain the difference between exit() and _exit() function?

1047


What is property type c?

1099


diff between exptected result and requirement?

2071


find out largest elemant of diagonalmatrix

2269


What is difference between Structure and Unions?

1269