Program to input two digit number and print Sum of its digits.

In this program input two digit number and print the sum of its digits. For this we find 1st digit by number/10 and 2nd digit by n%10. 

#include<stdio.h>
#include<conio.h>
void main()
{
int n,d1,d2,s=0;
clrscr();
printf("Enter two digit number=");
scanf("%d",&n);
d1=n/10;
d2=n%10;
s=d1+d2;
printf("\nSum of digits=%d",s);
getch();
}

OUTPUT 


Comments

Popular posts from this blog

Write a program to input age of any person and check he is eligible for voting or not.

Write a program to input two digit number and check number is palindrome or not.

Write a program to input speed of Royal Enfield and check it's running at economic speed or not.