1. Program to find the sum of the last and first digits of given number.
#include<stdio.h>
int main()
{
int n,b,sum,lastn,firstn;
printf("enter numbers: ");
scanf("%d",&n);
lastn=n%10;
while(n>=10)
n=n/10;
printf("last number=%d\nfirst number=%d",lastn,n );
sum=lastn+n;
printf("\nsum=%d+%d=%d",lastn,n,sum);
return 0;
}
Comments
Post a Comment