If 4 digits number is input through the keyboard, Write a
program to calculate sum of its 1st & 4th digit.

Answer Posted / nikita singh

#include<stdio.h>
#include<conio.h>
void main()
{
int num,a,b,sum;
clrscr();
printf("enter a four digit no");
scanf("%d",&num);
a=num%10;
b=num/1000;
sum=a+b;
printf("sum is =%d",sum);
getch();
}

Is This Answer Correct ?    24 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why main function is special give two reasons?

953


what are bit fields in c?

609


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1547


Why flag is used in c?

657


Which function in C can be used to append a string to another string?

649






formula to convert 2500mmh2o into m3/hr

501


What are the preprocessor categories?

641


What should malloc() do? Return a null pointer or a pointer to 0 bytes?

628


What is #include conio h?

598


What are structures and unions? State differencves between them.

619


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

1962


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

622


What are global variables and explain how do you declare them?

582


How can my program discover the complete pathname to the executable from which it was invoked?

664


What are the different types of C instructions?

681