Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int a[4] = {1,2,3,4};
- int c[10];
- int b[4];
- int dem = 0;
- int Check(int a[]) {
- if (a[0] == 0 || a[3] == 0) return 0;
- return 1;
- }
- void Tim(int i) {
- int j;
- for (j = 0; j < 4; j++) {
- if (c[a[j]] != 1) {
- b[i] = a[j];
- c[a[j]] = 1;
- if (i == 3) {
- if (Check(b) == 1) {
- dem++;
- for (int g = 0; g < 4; g++) {
- printf("%d",b[g]);
- if (g == 2) printf(".");
- }
- printf("\n");
- }
- } else Tim(i+1);
- c[a[j]] = 0;
- }
- }
- }
- int main() {
- Tim(0);
- printf("Vay co tat ca %d cach sap!",dem);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement