program to sum first and last digit of a four digit number.

#include<stdio.h>
#include<conio.h>
void main()
{
      int n,r,sum;
    printf(“enter the four digit number”);
    scanf(“%d”,&n);
   r=n%10;
   sum=sum+r;
   n=n/1000;
   r=n%10;
   sum=sum+r;
   printf(“sum of first and last digit is %d “,sum);
  getch();
}

3 thoughts on “program to sum first and last digit of a four digit number.

Leave a Reply

Your email address will not be published.