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


Please Help Members By Posting Answers For Below Questions

What is sizeof return in c?

611


Which programming language is best for getting job 2020?

605


How macro execution is faster than function ?

660


What are derived data types in c?

606


What is a MAC Address?

624






the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

1901


Explain what header files do I need in order to define the standard library functions I use?

645


hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?

1654


Is c procedural or functional?

582


Is c programming hard?

573


For what purpose null pointer used?

606


What is pass by value in c?

593


How does struct work in c?

604


What are qualifiers?

613


What are loops c?

614