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


Please Help Members By Posting Answers For Below Questions

Can you please explain the difference between strcpy() and memcpy() function?

595


What is the function of this pointer?

668


Why is it that not all header files are declared in every C program?

676


What math functions are available for integers? For floating point?

616


What is structure of c program?

599






Who is the founder of c language?

676


What type of function is main ()?

581


What is floating point constants?

685


What is getch() function?

645


If you know then define #pragma?

672


The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.

1056


What is the correct declaration of main?

675


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1527


Explain how can I open a file so that other programs can update it at the same time?

586


What are the data types present in c?

623