input any 4 digit number and find the difference of all the
digits?
Answer Posted / nitin garg
int j,num,rem,diff=0;
printf("
Enter Digit
");
scanf("%d",&num);
while(num!=0)
{
rem=num%10;
j=rem+rem;
diff=diff-rem;
num=num/10;
}
diff=diff+j;
printf("
Difference of Digit is : %d",diff);
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does typeof return in c?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
What is static volatile in c?
What is sizeof int in c?
How are pointers declared in c?
Explain how can I make sure that my program is the only one accessing a file?
Is c dynamically typed?
What is #define in c?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
Why is structure important for a child?
What is a header file?
What is the difference between near, far and huge pointers?
Write a program to swap two numbers without using third variable in c?
What are the 4 data types?
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?