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
What is extern variable in c with example?
What is getch() function?
What is output redirection?
Should I learn data structures in c or python?
In C language, a variable name cannot contain?
What is a method in c?
What does node * mean?
What is the value of c?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
What is the difference between test design and test case design?
Why n++ execute faster than n+1 ?
Why can’t we compare structures?
What is a function in c?
If the size of int data type is two bytes, what is the range of signed int data type?
What is the use of putchar function?