汽車超速問題

#include <stdio.h>
#include <stdlib.h>

int main()
{
    float cs,xs;
    float chao;
    int x;
    printf("輸入在一行中給出2個正整數,分別對應車速和限速,其間以空格分隔cs xs:\n");
    while( scanf("%f%f",&cs,&xs)!=EOF)
   {
       chao=(cs-xs)/xs;
        x=chao*100;
        if(x<10&&x>=0)
        printf("ok");
        else if(x>0&&x<=10)
        {
            printf("eceed %d%%.ticket200\n",x);
        }
        else if(x>=50)
        printf("eceed%d%% license revoked",x);
   }

    return 0;
}

這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章