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
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
What is a stream in c programming?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What is the difference between declaring a variable and defining a variable?
write a program to print largest number of each row of a 2D array
What is multidimensional arrays
I came across some code that puts a (void) cast before each call to printf. Why?
Explain what are its uses in c programming?
How can you call a function, given its name as a string?
What is the use of in c?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
Explain what are the __date__ and __time__ preprocessor commands?
What is an lvalue?
How can I read/write structures from/to data files?
write a program to copy the string using switch case?