用for while 成绩的有效输入

#include "stdio.h"
void main()
{
   int score,s;
    printf("请输入你的成绩:");
    scanf("%d",&s);
    score=s;
    for(;score<0||score>100;)
   
        {
            printf("您输入有误,请重新输入:");
            scanf("%d",&score);
         }
    while(score<=100&&score>=0)
    {
        printf("你的成绩是:%d",score);
        score=score+101;
    }
}

 

posted on 2016-10-30 23:06  梁锦杰  阅读(254)  评论(0编辑  收藏  举报

导航

欢迎进入我的博客!