C语言 homework (3)


 
#include<stdio.h> 
#include<stdlib.h>
#include<time.h>
int main()
{
    int yournumber,mynumber,count=0;    
    char c;
    do{
        srand((unsigned)time(NULL));
        mynumber=(rand()%(101-1)+1);
    do{
    printf("请输入您所猜的数字:");
    scanf("%d",&yournumber);
            count++; 
            if(yournumber>mynumber)
                printf("大了
");
            else if (yournumber<mynumber)
                printf("小了
");
            else (yournumber==mynumber)
                printf("猜对了!:
");
      }while(yournumber!=mynumber);
    printf("您一共猜了:%d次
",count);
    if(count<=3)
        printf("完美 你好聪明
");
    else if(count>4 && count<=7)
        printf("你智力还算正常的哦!
");
    else
        printf("哎呦 还是多干干不用脑子的事儿吧:
");
    printf("继续请按y|Y,退出请按n|N:");
    getwchar();
    c=getwchar();
    system("cls");
    } while(c=='y'||c=='Y');
    return 0;
}    

#include<stdio.h>
#include<math.h>
int main()
{
     int a,b,c,l,p,s;
     printf("请输入三个数:");
     scanf("%d%d%d",&a,&b,&c);    
    if(a+b>c && a-b<c) 
{
        l=a+b+c;
        p=(a+b+c)/2;
        s=sqrt(p*(p-a)*(p-b)*(p-c));
        printf("可以构成三角形:
");
        printf("三角形周长为 :%d
三角形面积为:%d",l,s);    
}
    else
        printf("不可以构成三角形:"); 
    return 0;
}  

 

#include<stdio.h>
int main()
{
    float a,tax=0,taxincome=0;
    printf("请输入您的工资:");
    scanf("%f",&a);
    if(a<=1455)
    {
        tax=(a-3500)*0.03;
        taxincome=a-tax;
    }
    else if(a>1455||a<=4155)
    {
        tax=(a-3500)*0.1-105;
        taxincome=a-tax;    
    } 
    else if(a>4155||a<=7755)
    {
        tax=(a-3500)*0.2-555;
        taxincome=a-tax;
    }
    else if(a>7755||a<=27255)
    {
        tax=(a-3500)*0.25-1005;
        taxincome=a-tax;
    }
    else if(a>27255||a<=41255)
    {
        tax=(a-3500)*0.3-2755;
        taxincome=a-tax;
    }
    else if(a>41255||a<=57505)
    {
        tax=(a-3500)*0.35-5505;
        taxincome=a-tax;
    }
    else 
    {
        tax=(a-3500)*0.45-13505;
        taxincome=a-tax;
    }
    printf("您本月应交税为:%f
您本月的税后收入为:%f
",tax,taxincome);
    return 0;}

原文地址:https://www.cnblogs.com/amber219/p/5946953.html