Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void input_nums(int *lotto_nums);
- void print_nums(int *lotto_nums);
- int main(void)
- {
- int lotto_nums[6];
- input_nums(lotto_nums);
- print_nums(lotto_nums);
- return 0;
- }
- void input_nums(int *lotto_nums)
- {
- int cnt, temp_num;
- while(cnt < 6)
- {
- int cksum=0;
- printf("번호 입력 : ");
- scanf("%d", &temp_num);
- for(int scan=0;scan<cnt;scan++)
- {
- if(lotto_nums[scan]==temp_num) cksum=1;
- }
- if (cksum==1) printf("같은 번호가 있습니다.\n");
- else
- {
- lotto_nums[cnt] = temp_num;
- cnt++;
- }
- }
- }
- void print_nums(int *lotto_nums)
- {
- printf("로또 번호 : ");
- for(int op=0;op<6;op++)
- {
- printf("%d ",lotto_nums[op]);
- }
- printf("\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement