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


Please Help Members By Posting Answers For Below Questions

Does c have an equivalent to pascals with statement?

576


Is null always defined as 0(zero)?

618


What is the purpose of sprintf() function?

608


What are logical errors and how does it differ from syntax errors?

663


Why do we use null pointer?

609






Do array subscripts always start with zero?

788


What is s in c?

621


differentiate built-in functions and user – defined functions.

634


Explain how can a program be made to print the line number where an error occurs?

698


What is variables in c?

611


Simplify the program segment if X = B then C ← true else C ← false

2589


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

3735


What are the advantages of external class?

598


Should a function contain a return statement if it does not return a value?

601


What are the functions to open and close file in c language?

733