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


Please Help Members By Posting Answers For Below Questions

Explain about block scope in c?

657


Explain zero based addressing.

604


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

1760


Explain the process of converting a Tree into a Binary Tree.

2096


Tell me when would you use a pointer to a function?

603






Does c have an equivalent to pascals with statement?

570


Who invented bcpl language?

700


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1491


When can a far pointer be used?

586


what is the difference between 123 and 0123 in c?

716


What is variable in c example?

590


What is string function c?

561


How is pointer initialized in c?

581


What is use of bit field?

768


about c language

1597