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 / abhilash

/*Hey
guys check dis out, It will work for upto 4 digit number*/
void main()
{
int num,sum=0,rem;
printf("Enter a number");
scanf(" %d",&num);
rem=num%10;
sum=sum+rem;
while(n>10)
{
num=num/10;
}
rem=num%10;
sum=sum+rem;
printf("sum of 2 digits is: %d",sum);
getch();
}

Is This Answer Correct ?    9 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is static and auto variables in c?

1094


Are enumerations really portable?

1036


Who developed c language and when?

1074


Is it better to use a macro or a function?

1171


What is meant by type specifiers?

1142


How can I do graphics in c?

1040


Explain what is output redirection?

1204


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

1175


How to create struct variables?

1119


Write a program to print factorial of given number using recursion?

1023


Write a program to reverse a string.

1086


formula to convert 2500mmh2o into m3/hr

1005


Difference between exit() and _exit() function?

1146


If the size of int data type is two bytes, what is the range of signed int data type?

1028


what are the facialities provided by you after the selection of the student.

2270