1/28 if

#include <stdio.h>
// judge the number whether can be divisible by 3 or 5
int main()
{
    printf("judge the number a ,whether can be divisible by 3 or 5\n");
    int a;
    scanf("%d",&a);
    int b,c;
    b=a%3;
    c=a%5;
    if ((b==0)||(c==0))
    {
        printf("%d\n",a);
    }
    return 0;
}

#include <stdio.h>
//if a+b<100 print a+b
//if a+b>100 print a+b>=10^2
int num_100above(int a)
{
    int b;
    b=a/10;
    return b;
}
int main()
{
    printf("please insert a and b\n");
    int a,b;
    scanf("%d %d",&a,&b);
    if(a+b<=100)
    {
        printf("%d",a+b);
    }
    else
    {
        printf("%d",num_100above(a+b));
    }
    return 0;
}

#include <stdio.h>
//calculate y=x-1(x>=1)
//y=-x+1(x<1)
int main()
{
    printf("insert x\n");
    int x,y;
    scanf("%d",&x);
    if(x>=1)
    {
        y=x-1;
    }
    else
    {
        y=-x+1;
    }
    printf("%d\n",y);
    return 0;
}

#include <stdio.h>
#include <math.h>
double yx(double x)
{
    double y;
    if(x>=0)
    {
        y=(sin(x)+cos(x))/2.0;
    }
    else
    {
        y=(sin(x)-cos(x))/2.0;
    }
    return y;
}


int main()
{
    double y,x;
    printf("insert x\n");
    scanf("%lf",&x);
    y=yx(x);
    printf("%f",y);
    return 0;
}

#include <stdio.h>
//calculate salary
//h=40
//if h=40 salary=rate*hour
//if h>=40 addition=rate*1.5*addhours
int main()
{
    int rate,hours,addhours;
    double salary;
    printf("insert rate and hours\n");
    scanf("%d %d",&rate,&hours);
    if(hours<=40)
    {
        salary=rate*hours;
    }
    else
{


    addhours=hours-40;
    salary=40*rate;
    salary=salary+addhours*1.5*rate;
}
printf("salary is %f\n",salary);
    return 0;
}

#include <stdio.h>
int main()
{
    printf("please insert hours and minutes\npay attention to sequence\n");
    int hours,minutes;
    scanf("%d %d",&hours,&minutes);
    if(hours<=9)
    {
        printf("0");
    }
    printf("%d:",hours);
    if(minutes<=9)
    {
        printf("0");
    }
    printf("%d\n",minutes);
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值