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

What is null character in c?

695


Why static is used in c?

627


What language is windows 1.0 written?

579


An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above

650


What is table lookup in c?

633






why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

656


What's a good way to check for "close enough" floating-point equality?

630


Write a program to swap two numbers without using the third variable?

602


Explain the use of keyword 'register' with respect to variables.

593


Explain about C function prototype?

613


What are logical errors and how does it differ from syntax errors?

663


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

630


Why is c faster?

596


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1470


Why should I prototype a function?

644