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

Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1945


What is a stream in c programming?

1232


Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

1110


What is the difference between declaring a variable and defining a variable?

1348


write a program to print largest number of each row of a 2D array

2372


What is multidimensional arrays

1176


I came across some code that puts a (void) cast before each call to printf. Why?

1270


Explain what are its uses in c programming?

1127


How can you call a function, given its name as a string?

1209


What is the use of in c?

1086


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

1138


Explain what are the __date__ and __time__ preprocessor commands?

1161


What is an lvalue?

1107


How can I read/write structures from/to data files?

1015


write a program to copy the string using switch case?

2950