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
What is strcmp in c?
With the help of using classes, write a program to add two numbers.
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
What is double pointer in c?
What is the use of a conditional inclusion statement in C?
Once I have used freopen, how can I get the original stdout (or stdin) back?
List some applications of c programming language?
What is a header file?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
How many types of operator or there in c?
What are the different types of constants?
Is main is a keyword in c?
What is the purpose of ftell?
Why #include is used in c language?
What are the c keywords?