Erster Commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// 531
|
||||
// 135
|
||||
// Units
|
||||
// Tens
|
||||
// Hundreds
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
int num;
|
||||
int units, tens, hundreds;
|
||||
int reversenum;
|
||||
|
||||
printf("Bitte geben sie eine dreistellige Zahl ein: \n");
|
||||
scanf("%d", &num);
|
||||
|
||||
units = num % 10;
|
||||
tens = (num / 10) % 10;
|
||||
hundreds = num / 100;
|
||||
|
||||
printf("units: %d\n", units);
|
||||
printf("tens: %d\n", tens);
|
||||
printf("hundreds %d\n", hundreds);
|
||||
|
||||
reversenum = units * 100;
|
||||
reversenum = reversenum + tens * 10;
|
||||
reversenum = reversenum + hundreds;
|
||||
|
||||
printf("The reverse number is: %d\n", reversenum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user