Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int num;
- int x=1000, y=10, z=100;
- int a1, b1, c1, d1;
- char a, b, c, d;
- printf("Enter 4 digits:");
- scanf("%c",&a);
- rewind(stdin);
- scanf("%c",&b);
- rewind(stdin);
- scanf("%c",&c);
- rewind(stdin);
- scanf("%c",&d);
- a = (a - 48);
- a1 = (int)a*x;
- b = (b - 48);
- b1 = (int)b*y;
- c = (c - 48);
- c1 = (int)c*z;
- d = (d - 48);
- d1 = (int)d;
- num = a1 + b1 + c1 + d1;
- printf("The number is: %c,%c,%c,%c",a1,b1,c1,d1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement