If 4 digits number is input through the keyboard, Write a
program to calculate sum of its 1st & 4th digit.
Answer Posted / abhilash
/*Hey
guys check dis out, It will work for upto 4 digit number*/
void main()
{
int num,sum=0,rem;
printf("Enter a number");
scanf(" %d",&num);
rem=num%10;
sum=sum+rem;
while(n>10)
{
num=num/10;
}
rem=num%10;
sum=sum+rem;
printf("sum of 2 digits is: %d",sum);
getch();
}
Is This Answer Correct ? | 9 Yes | 8 No |
Post New Answer View All Answers
Explain about block scope in c?
Explain zero based addressing.
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
Explain the process of converting a Tree into a Binary Tree.
Tell me when would you use a pointer to a function?
Does c have an equivalent to pascals with statement?
Who invented bcpl language?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
When can a far pointer be used?
what is the difference between 123 and 0123 in c?
What is variable in c example?
What is string function c?
How is pointer initialized in c?
What is use of bit field?
about c language