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

Answer Posted / anil

#include<stdio.h>
#include<conio.h>
void main()
{
int num,first,last,total;
printf("enter the 4 digit number");
scanf("%d",&num);
first=num/1000;
last=num%10;
total=first+last;
printf("the total of first and last digit is %d",total);
getch();
}

Is This Answer Correct ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is %lu in c?

689


What are the different types of errors?

648


What are the main characteristics of c language describe the structure of ac program?

616


How will you delete a node in DLL?

688


How many types of arrays are there in c?

599






What is the scope of an external variable in c?

571


Can a local variable be volatile in c?

584


What is getch () for?

681


Explain what are preprocessor directives?

634


What is integer constants?

626


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

638


What are the 4 types of functions?

576


the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

644


What do you know about the use of bit field?

614


How can I call fortran?

647