31 Aralık 2012 Pazartesi

成績評等


成績評等

成績: 0 / 倒扣: 0.8

請輸入一個0到100的分數,區分為優等(90-100)、甲等(80-89)、乙等(70-79)、丙等(60-69)、丁等(0-59),若輸入不在0-100的區間,則顯示error!!
輸入值可能是浮點數。
例如:

Input

100

Output

優等

Input

50

Output

丁等


  1. int main(int argc, char *argv[])    
  2. {    
  3.     double a;     
  4.     scanf("%lf",&a);    
  5.     
  6.     if ((a>=90)&&(a<=100)){    
  7.        printf("優等\n");    
  8.        }    
  9.     else if((a>=80)&&(a<=89)){    
  10.        printf("甲等\n");    
  11.          }    
  12.     else if((a>=70)&&(a<=79)){    
  13.        printf("乙等\n");    
  14.          }    
  15.     else if((a>=60)&&(a<=69)){    
  16.        printf("丙等\n");    
  17.          }             
  18.     else if((a>=0)&&(a<60)){    
  19.     printf("丁等\n");    
  20.          }    
  21.   else {    
  22.        printf("error!!\n");    
  23.        }    
  24.     
  25.   system("PAUSE");      
  26.   return 0;    
  27. }  

Hiç yorum yok:

Yorum Gönder

Binary Conversion

Problem Description Convert two binary numbers into two decimal numbers and compute their sum. Your program has to convert two binary number...