C言語--入力された整数に数字が重複しているかどうかを判断します

902 ワード

//  repeat.c
//  day05
//
//           , :12345,                        。
//  Created by apple on 13-6-6.
//  Copyright (c) 2013  apple. All rights reserved.
//

#include 
#include
int main()
{
    long int num,temp;
    int i=1;
    printf("       :");
    scanf("%ld",&num);
    temp = num;
    
    //          。
    while(temp/10>0){
        i+=1;
        temp = temp/10;
    }
    
    //          ,     bool   。
    printf("   %d  。
",i); bool a[i+1]; // 0. for(int j=0;jdo{ int n = num % 10; if(a[n]==1){ printf(" 。
"); break; } a[n] = 1; num /= 10; }while(num); if(num==0){ printf(" 。
"); } return 0; }