Examples of a C language

Title: 1,2,3,4 figures, the number of other with no repeat of the three-digit numbers can be composed? How much are?

Program analysis: can be filled in one hundred, ten digital bits are 1,2,3,4. Composition before removing all permutations arrangement conditions are not satisfied.

#include<stdio.h>
int main(){
   int i,j,k;
   printf("\n");
   for(i=1;i<5;i++){
       for(j=1;j<5;j++){
          for(k=1;k<5;k++){
               if(i!=j&&i!=k&&j!=k){
                    printf("%d,%d.%d\n",i,j,k);                 
       }
     }
   }
 }
}

Here Insert Picture DescriptionA star is found in the comments section of forgot to count how many number secretly to correct ~ ~ ~ ~

  #include<stdio.h>
  int main(){
  int i,j,k;
  int count=0;
  printf("\n");
  for(i=1;i<5;i++){
   for(j=1;j<5;j++){
      for(k=1;k<5;k++){
           if(i!=j&&i!=k&&j!=k){
                printf("%d,%d.%d\n",i,j,k); 
				count++;                
   }
 }
}
}
printf("%d",count);
}

Here Insert Picture Description

Guess you like

Origin blog.csdn.net/weixin_44097082/article/details/94652174