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 is restrict keyword in c?

1049


what is the syallabus of computer science students in group- 1?

2256


What is #define in c?

990


Explain what is a pragma?

991


What is ambagious result in C? explain with an example.

2550


Can you apply link and association interchangeably?

1070


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

2018


Do character constants represent numerical values?

1284


What is the purpose of clrscr () printf () and getch ()?

1020


Write a program to identify if a given binary tree is balanced or not.

1089


What is nested structure in c?

1011


What is a program flowchart and how does it help in writing a program?

1082


What are the types of pointers?

1031


what is event driven software and what is procedural driven software?

2505


How can you read a directory in a C program?

1091