C Program to sum first and last digit of a number

      No Comments on C Program to sum first and last digit of a number
#include<stdio.h>
#include<conio.h>
void main()
{
	int a,x,y,n,sum;
	clrscr();
	printf("Enter a number:- ");
	scanf("%d",&a);
	n=a;
	y=n%10;
	while(n!=0)
	{
		x=n%10;
		n=n/10;

	}
	printf("Sum of first and last digit:- %d",y+x);
getch();
}

OUTPUT:-

sum

Leave a Reply

Your email address will not be published. Required fields are marked *