Answer Posted / vani
//sum of digits in c//
#include<stdio.h>
#include<conio.h>
void main()
{
int n,r,sum=0;
clrscr();
printf("\n enter the number:");
scanf("%d",&n);
while(n!=0)
{
r=n%10;
sum=sum+r;
n=n/10;
}
printf("sum=%d");
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
can any one provide me the notes of data structure for ignou cs-62 paper
Can you please explain the difference between syntax vs logical error?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What are the types of variables in c?
What is keyword in c?
Write a function that will take in a phone number and output all possible alphabetical combinations
What is the difference between array and linked list in c?
Explain what are the advantages and disadvantages of a heap?
Explain what is a const pointer?
When the macros gets expanded?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
Can i use “int” data type to store the value 32768? Why?
how should functions be apportioned among source files?
What is the difference between array_name and &array_name?
Describe the difference between = and == symbols in c programming?