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 does malloc () calloc () realloc () free () do?
What is an lvalue?
what is recursion in C
Is c++ based on c?
Is array name a pointer?
What are qualifiers in c?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
Write a program to print numbers from 1 to 100 without using loop in c?
What is structure of c program?
If errno contains a nonzero number, is there an error?
What is else if ladder?
What is the difference between call by value and call by reference in c?
How variables are declared in c?
what are # pragma staments?
What is the c value paradox and how is it explained?