MUstar

IoT C언어 0626 - ex_02

Jun 26th, 2017
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int check_same(int *lotto_nums,int *my_nums);
  4.  
  5. int main(void)
  6. {
  7.     int lotto_nums[6] = {4, 10, 25, 30, 41, 45};
  8.     int my_nums[6] = {1, 4, 7, 22, 41, 43};
  9.    
  10.     check_same(lotto_nums, my_nums);
  11.    
  12.     return 0;
  13. }
  14.  
  15. int check_same(int *lotto_nums,int *my_nums)
  16. {
  17.     int cnt=0 , cknum=0;
  18.     while(cnt<6)
  19.     {
  20.         for(int i=0;i<6;i++)
  21.         {
  22.             if(lotto_nums[cnt]==my_nums[i]) cknum++;
  23.         }
  24.         cnt++;
  25.     }
  26.     if (cknum == 0)printf("일치하지 않는 숫자가 없어요,\n");
  27.     else printf("일치하는 번호의 개수 : %d\n", cknum);
  28. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×