วันอาทิตย์ที่ 17 กรกฎาคม พ.ศ. 2554

การทดลองที่ 4 และ 5 การใช้งานคำสั่งวนรอบ

ข้อ7
#include<stdio.h>
#include<conio.h>
main()
{
      int num;
      char a='Y';
      do
      {
             printf("Enter Number : ");
             scanf("%d",&num);
             if(num%2==0)
             {
                   printf("%d is even number\n",num);
             }
             else
             {
                   printf("%d is odd numer\n",num);
             }
              printf("Do you want to countinue(Y/N) : ");
              //scanf("%c",&a);
              a=getche();
              printf("\n\n");
              printf("*************************\n\n");
      }
    
      while(a=='Y');
      getch();
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น