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

What does malloc () calloc () realloc () free () do?

1103


What is an lvalue?

1107


what is recursion in C

1117


Is c++ based on c?

1131


Is array name a pointer?

1077


What are qualifiers in c?

1089


the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

1304


Write a program to print numbers from 1 to 100 without using loop in c?

1136


What is structure of c program?

1229


If errno contains a nonzero number, is there an error?

1430


What is else if ladder?

1075


What is the difference between call by value and call by reference in c?

1212


How variables are declared in c?

1099


what are # pragma staments?

2079


What is the c value paradox and how is it explained?

1107