If 4 digits number is input through the keyboard, Write a
program to calculate sum of its 1st & 4th digit.
Answer Posted / jagannatha reddy
#include<stdio.h>
#include<conio.h>
void main()
{
int i,r,n,m=0;
clrscr();
printf("enter any 4 digit number");
scanf("%d",&n);
r=n%10;
for(i=1;i<=3;i++)
{
n=n/10;
}
printf("the sum is %d",(r+m));
}
Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
Does c have an equivalent to pascals with statement?
Is null always defined as 0(zero)?
What is the purpose of sprintf() function?
What are logical errors and how does it differ from syntax errors?
Why do we use null pointer?
Do array subscripts always start with zero?
What is s in c?
differentiate built-in functions and user – defined functions.
Explain how can a program be made to print the line number where an error occurs?
What is variables in c?
Simplify the program segment if X = B then C ← true else C ← false
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
What are the advantages of external class?
Should a function contain a return statement if it does not return a value?
What are the functions to open and close file in c language?