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

Answer Posted / sourav sinha

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int num,n1,n2,sum;
clrscr();
printf("Enter 4 digit number:");
scanf("%d",&num);
n1=num/1000;
n2=num%10;
sum=n1+n2;
printf("Sum of 1st & 4th digit number is=%d",sum);
getch();
}
enjoy!!!!!!!!!!!!

any program just mail me:
ssmartinp@gmail.com

Is This Answer Correct ?    57 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between char array and char pointer?

527


Are bit fields portable?

681


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

1421


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

609


Explain how can you tell whether a program was compiled using c versus c++?

582






how do you execute a c program in unix.

641


Write a program to find the biggest number of three numbers in c?

590


What functions are used in dynamic memory allocation in c?

599


Explain how do you convert strings to numbers in c?

598


Explain what math functions are available for integers? For floating point?

618


code for quick sort?

1626


Explain what is the general form of a c program?

627


if p is a string contained in a string?

1406


What are register variables? What are the advantage of using register variables?

689


Write a program to reverse a given number in c language?

623