PPS Practical 20
- Aim: Write a program to find out sum of first and last digit of a given number.
- Code:
//For turbo C++ remove below comments #include <stdio.h> //#include<conio.h> void main() { int n,last,first; // clrscr(); printf("Enter Number : "); scanf("%d",&n); last=n%10; first=n; while (first>10){ first/=10; } printf("Sum of first and last digit of number %d is : %d",n,(first+last)); // getch(); }
- Output:

Comments
Post a Comment