Sum Of Random Two Digit Number
#include <stdio.h>
int main() {
int number, sum;
// Prompt the user for a two-digit number
printf("Enter a two-digit number: ");
// Read the number using scanf
scanf("%d", &number);
// Extract the digits
int digit1 = number / 10;
int digit2 = number % 10;
// Calculate the sum
sum = digit1 + digit2;
// Display the sum
printf("digit 1 = %d\n",digit1);
printf("The sum of the digits is: %d\n", sum);
printf(" reverse %d%d",digit2,digi
t1);
return 0;
}
Comments
Post a Comment