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

write a program to rearrange the array such way that all even elements should come first and next come odd

1770


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

656


Why is this loop always executing once?

625


How is = symbol different from == symbol in c programming?

624


How main function is called in c?

636






What are header files why are they important?

592


What is the sizeof () operator?

632


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

789


What are the 5 data types?

613


Can a variable be both static and volatile in c?

618


Explain how do you override a defined macro?

598


When c language was developed?

646


What is logical error?

610


How a string is stored in c?

597


What functions are used for dynamic memory allocation in c language?

615