Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
- void f(int x)
- {
- if (x & 4) {
- printf("r");
- } else {
- printf("-");
- }
- if (x & 2) {
- printf("w");
- } else {
- printf("-");
- }
- if (x & 1) {
- printf("x");
- } else {
- printf("-");
- }
- }
- int main(int argc, char **argv)
- {
- int one;
- int two;
- int three;
- int x;
- int i = 0;
- for (i = 1 ;i < argc ; i++) {
- sscanf(argv[i] , "%о", &x);
- one = x / 100;
- f(one);
- two = (x / 10) % 10;
- f(two);
- three = x % 10;
- f(three);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement