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 c mean before a date?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
Do pointers take up memory?
Differentiate between functions getch() and getche().
What are categories used for in c?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
What is the difference between a string and an array?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
What's a good way to check for "close enough" floating-point equality?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
Why doesnt long int work?
what do you mean by enumeration constant?
Why do we use namespace feature?