Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 scope and lifetime of a variable in c?

1118


What is the difference between mpi and openmp?

1357


How reliable are floating-point comparisons?

1150


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

1148


Explain the use of 'auto' keyword

1171


What is the use of a ‘’ character?

1142


How do you write a program which produces its own source code as output?

1173


What does stand for?

1141


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.

1155


Tell me what is the purpose of 'register' keyword in c language?

1039


What is the full form of getch?

1355


How do you convert strings to numbers in C?

1296


What is a memory leak? How to avoid it?

1422


What is variables in c?

1096


Give me the code of in-order recursive and non-recursive.

1421