/**
* Author : Berk Soysal
*/
#include <stdio.h>
void main()
{
int num, temp, digit, sum ;
printf("Enter a TWO digit number: \n");
scanf("%d", &num);
if(num > 9 && num < 100)
{
temp = num;
digit = num % 10;
num /= 10;
sum = num + digit;
printf("Given number = %d\n", temp);
printf("Sum of the digits = %d\n", sum);
}
else
{
printf("\n\n ERROR !! Please Enter a TWO Digit Number !\n\n");
}
}
Result
Please leave a comment if you have any questions !
Read more course about C Code:
Learn to Program with C++
Object Oriented Programming with C++
C++ Programming from Zero to Hero: The Fundamentals
Advanced C++ Programming Training Course
C++: From Beginner to Expert
Object Oriented Programming with C++
C++ Programming from Zero to Hero: The Fundamentals
Advanced C++ Programming Training Course
C++: From Beginner to Expert
No comments:
Post a Comment