Sum of first and last digit of a four-digit number
Write a program which takes a four-digit number as input and shows the sum of first and last digit.
#include
#include
void main(void)
{
int a,c,d,f;
printf("Enter the Four-Digit Number:");
scanf("%d",&a);
c=a/1000+a%10;
printf("The sum is:%d",c);
getch();
}
#include
#include
void main(void)
{
int a,c,d,f;
printf("Enter the Four-Digit Number:");
scanf("%d",&a);
c=a/1000+a%10;
printf("The sum is:%d",c);
getch();
}
Comments
Post a Comment