#include <stdio.h>
#include <conio.h>
using namespace std;
int main ()
{
int num,sum,a,b,c,d,d1,d2,d3,d4;
printf(" Enter a four digits number \n");
scanf("%d",&num);
a=num/10;
d4=num%10;
b=a/10;
d3=a%10;
c=b/10;
d2=b%10;
d=c/10;
d1=c%10;
sum=d1+d4;
printf(" Sum of first & last digit = %d",sum);
return 0;
}
No comments:
Post a Comment
Must drop your comments about post.