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
What is the difference between char array and char pointer?
Are bit fields portable?
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
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
Explain how can you tell whether a program was compiled using c versus c++?
how do you execute a c program in unix.
Write a program to find the biggest number of three numbers in c?
What functions are used in dynamic memory allocation in c?
Explain how do you convert strings to numbers in c?
Explain what math functions are available for integers? For floating point?
code for quick sort?
Explain what is the general form of a c program?
if p is a string contained in a string?
What are register variables? What are the advantage of using register variables?
Write a program to reverse a given number in c language?