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
Can two or more operators such as and be combined in a single line of program code?
Is c compiled or interpreted?
Which function in C can be used to append a string to another string?
What is a program?
What do you mean by scope of a variable in c?
Which is best linux os?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
How do you define CONSTANT in C?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
Why we write conio h in c?
What is the role of this pointer?
What are the types of i/o functions?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
Why c is called a mid level programming language?
write a program to generate address labels using structures?