栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

C语言练习2

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

C语言练习2

25.

#include 
int main ()
{
        int n;
        scanf("%d",&n);
                if(n>=0)
                {
                if(n>0)
                        {
                        printf("sign(%d) = 1n",n);
                        else printf("sign(%d) = 0n",n);
                        }
                }
                        else printf("sign(%d) = -1n",n);
                return 0;
}

26.

#include
int main()
{
    int arr[3];
    scanf("%d %d %d",&arr[0],&arr[1],&arr[2]);
    int i;
    int index;
    int temp;
    int j;
    for(i=0;i<2;i++)
    {
        index=i;
        temp=arr[i];
        for(j=i+1;j<3;j++)
        {
           if(arr[j]<=arr[index]) index=j;
        }
        arr[i]=arr[index];
        arr[index]=temp;
    }
    printf("%d->%d->%dn",arr[0],arr[1],arr[2]);
    return 0;
}

27.

#include
int main()
{
    int m;
    int n; 
    scanf("%d %d",&m,&n);
    int t1=n+n*0.1;
    int t2=n+n*0.5;
    printf("%d %dn",t1,t2);
    if(m=t1&&m=0.5) temp=(int)temp1+1;
        else temp=(int)temp1;
        printf("Exceed %d%%. Ticket 200n",temp);
    }
    if(m>=t2)
    {
        double temp1=(m-n)/(double)n*100.0;
        double temp2=temp1-(int)temp1;
        int temp;
        if(temp2>=0.5) temp=(int)temp1+1;
        else temp=(int)temp1;
        printf("Exceed %d%%. License Revokedn",temp);
    }
return 0;
}

28

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/997560.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号