Answer Posted / d. prashant
#include<stdio.h>
#include<conio.h>
main()
{
int n,i,sum=0,r;
printf("enter the value");
scanf("%d",&n);
while(n)
{
rem=num%10;
sum=sum+rem;
num=num/10;
}
printf("sum = %d",sum);
}
| Is This Answer Correct ? | 7 Yes | 3 No |
Post New Answer View All Answers
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
In C language, a variable name cannot contain?
difference between native and cross compilers
Does c have an equivalent to pascals with statement?
Explain what are header files and explain what are its uses in c programming?
What is context in c?
Explain what are the __date__ and __time__ preprocessor commands?
Explain how do you override a defined macro?
What is the scope of an external variable in c?
What does int main () mean?
What is a structure in c language. how to initialise a structure in c?
what will be the output for the following main() { printf("hi" "hello"); }
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.