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 / kadher masthan ,...sit

thiz z how 2 find the sum of first and last digit of any
number

#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
long int n,nf,nl,temp;
int count=-1;
printf("Enter a number:");
scanf("%ld",&n);
temp =n;
while(temp<0)
{
temp=temp/10;
c++;
}
nl=n%10;
nf=n/(pow(10,c));
printf("\n%ldResult=",(nf+nl));
getch();
}

Is This Answer Correct ?    9 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a variable be both constant and volatile?

1112


What is break in c?

1022


What is cohesion and coupling in c?

1031


what are the advantages of a macro over a function?

1138


How variables are declared in c?

1035


"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above

1011


Where is volatile variable stored?

1083


List the variables are used for writing doubly linked list program.

2024


Is stack a keyword in c?

1078


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

1157


What is the use of bitwise operator?

1123


What does & mean in scanf?

1105


What are the loops in c?

991


What are categories used for in c?

1091


Can you add pointers together? Why would you?

1122