Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- void main()
- {
- int thousand = 1000;
- int hundred = 100;
- int ten = 10;
- char a, b, c, d;
- printf("Enter number for thousands: ");
- scanf("%c", &a);
- printf("Enter number for hundreds: ");
- rewind(stdin);
- scanf("%c", &b);
- printf("Enter number for tens: ");
- rewind(stdin);
- scanf("%c", &c);
- printf("Enter number for units: ");
- rewind(stdin);
- scanf("%c", &d);
- rewind(stdin);
- int newNumber = (int)(a-48) * thousand + (int)(b-48) * hundred + (int)(c-48) * ten + (int)(d-48);
- printf("%d", newNumber);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement