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 != Mean in c?
Linked lists -- can you tell me how to check whether a linked list is circular?
What are the advantages of c language?
What are the three constants used in c?
What is type qualifiers?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
What is dynamic memory allocation?
Explain how are 16- and 32-bit numbers stored?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
What is malloc and calloc?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What are pointers?
given post order,in order construct the corresponding binary tree
Why header file is used in c?
What is bubble sort in c?