第4次作业

#include<stdio.h>

main()
{
    int a;
    float b;
    char c;
    scanf("%d%f%c",&a,&b,&c);
    printf("%d\n%f\n%c\n",a,b,c);
}

 

 #include<stdio.h>

main()
{
    float s,l;
    printf("输入行驶距离:\n");
    scanf("%f",&l);
    if(l<=3)
        s=8;
        else
        s=(l-3)*1.6+8;
        printf("%.2f\n",s);
 
}

 

 #include<stdio.h>

main()
{
    int x;
    printf("输入一个数:\n");
        scanf("%f",&x);
    if (x%2==0)
    {printf("这是偶数\n");}
    else printf("这是奇数\n");
}

 

 #include<stdio.h>

main()
{
    float x,y;
    printf("输入一个数:\n");
        scanf("%f",&x);
    if (x<0)
    y=x*-1;
    else
        y=x;
    printf("这个数的绝对值是:%.1f\n",y);
}

 

 #include<stdio.h>

main()
{
    float x,y;
    printf("输入两个数:\n");
        scanf("%f%f",&x,&y);
    if (y>x)
    printf("较大数是:%f\n",y);
    else
    printf("较大数是:%f\n",x);
}

 

 

posted @ 2021-11-24 23:06  史孟琦  阅读(31)  评论(0)    收藏  举报