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 != Mean in c?

594


Linked lists -- can you tell me how to check whether a linked list is circular?

648


What are the advantages of c language?

668


What are the three constants used in c?

549


What is type qualifiers?

667






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

611


What is dynamic memory allocation?

812


Explain how are 16- and 32-bit numbers stored?

787


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

615


What is malloc and calloc?

578


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

1892


What are pointers?

636


given post order,in order construct the corresponding binary tree

2325


Why header file is used in c?

582


What is bubble sort in c?

640