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
Can a variable be both constant and volatile?
What is break in c?
What is cohesion and coupling in c?
what are the advantages of a macro over a function?
How variables are declared in c?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
Where is volatile variable stored?
List the variables are used for writing doubly linked list program.
Is stack a keyword in c?
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
What is the use of bitwise operator?
What does & mean in scanf?
What are the loops in c?
What are categories used for in c?
Can you add pointers together? Why would you?