c program to Accept 4 digit number and calculate addition of first and last number,
c program to Accept Four digit number and calculate addition of first and last number
#include
#include
void main()
{
int no,rem,sum=0;
clrscr();
printf("Enter the 4 digit number=");
scanf("%d",&no);
rem=no%10;
sum=sum+rem;
no=no/1000;
sum=sum+no;
printf("\n\nThe addition is first and last digit is=%d",sum);
getch();
}
#include
#include
void main()
{
int no,rem,sum=0;
clrscr();
printf("Enter the 4 digit number=");
scanf("%d",&no);
rem=no%10;
sum=sum+rem;
no=no/1000;
sum=sum+no;
printf("\n\nThe addition is first and last digit is=%d",sum);
getch();
}