Programming for Problem Solving

GTU Practical 20

20. Write a program to find out the sum of the first and last digits of a given number.
#include<stdio.h>  ( this applies in the given code )

#include

int main()
{
int no,sum=0;
printf(“\n Enter Any Number :”);
scanf(“%d”,&no);
if(no9)
{
no = no /10;
}
sum = sum + no;
}
printf(“\n Sum of First & Last Digit is : %d”,sum);
return 0;

}

OUTPUT

Enter Any Number :28

Sum of First & Last Digit is : 10

GTU STUDY