If 4 digits number is input through the keyboard, Write a
program to calculate sum of its 1st & 4th digit.
Answer Posted / bharghavi
#
#
void main()
{
int num,n1,n2,sum;
cout<<"enter a 4 digit no.";
cin>>num;
n1=num/1000;
n2=num%10;
sum=n1+n2;
cout<<"sum of 1st & 4th digit is"<<sum;
}
| Is This Answer Correct ? | 129 Yes | 35 No |
Post New Answer View All Answers
What does & mean in scanf?
write a program fibonacci series and palindrome program in c
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
What is pointer & why it is used?
What does *p++ do?
What is exit() function?
How many bytes is a struct in c?
What is function and its example?
Not all reserved words are written in lowercase. TRUE or FALSE?
What is a dynamic array in c?
difference between native and cross compilers
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Differentiate between Macro and ordinary definition.
How can you read a directory in a C program?
What are examples of structures?