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
Which are low level languages?
Explain low-order bytes.
What is 'bus error'?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
What is equivalent to ++i+++j?
What is the difference between class and object in c?
Can you write the function prototype, definition and mention the other requirements.
how should functions be apportioned among source files?
Why pointers are used?
Write program to remove duplicate in an array?
Explain what header files do I need in order to define the standard library functions I use?
What is c language in simple words?
Why do we use c for the speed of light?
What is %g in c?
Why #include is used in c language?