Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- int num1, num2, digit, numOut;
- printf("Enter a three-digit number: ");
- scanf("%d", &num1);
- printf("%d", num1);
- if(num1<100 || num1>999)
- {
- printf("Error : The number you have entered is not a three-digit number.\n");
- return 0;
- }
- while(num1>0)
- {
- digit = (num2+6)%10;
- num2 = num1%10;
- if(num1>100)
- numOut = digit;
- else if(num1>10)
- numOut = (digit*10)+numOut;
- else
- numOut = (digit*100)+numOut;
- num1 / 10;
- }
- printf("Output: %d\n", numOut);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement