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
Write a program on swapping (100, 50)
What is function and its example?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
What is the difference between malloc() and calloc() function in c language?
What are the types of data structures in c?
Explain what are the standard predefined macros?
What are formal parameters?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
How can I run c program?
How do you use a 'Local Block'?
Can a pointer be static?
How do you declare a variable that will hold string values?
shorting algorithmS
What is c standard library?
Tell us bitwise shift operators?