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 is scope and lifetime of a variable in c?
What is the difference between mpi and openmp?
How reliable are floating-point comparisons?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
Explain the use of 'auto' keyword
What is the use of a ‘ ’ character?
How do you write a program which produces its own source code as output?
What does stand for?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
Tell me what is the purpose of 'register' keyword in c language?
What is the full form of getch?
How do you convert strings to numbers in C?
What is a memory leak? How to avoid it?
What is variables in c?
Give me the code of in-order recursive and non-recursive.