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 does & mean in scanf?

1043


write a program fibonacci series and palindrome program in c

978


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.

2750


What is pointer & why it is used?

1061


What does *p++ do?

979


What is exit() function?

965


How many bytes is a struct in c?

1105


What is function and its example?

1110


Not all reserved words are written in lowercase. TRUE or FALSE?

1181


What is a dynamic array in c?

1072


difference between native and cross compilers

2080


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

1085


Differentiate between Macro and ordinary definition.

1273


How can you read a directory in a C program?

1095


What are examples of structures?

1026