首页 > 其他分享 >实验一

实验一

时间:2023-10-07 10:58:24浏览次数:27  
标签:main %. return int 实验 printf include

test1.1

#include<stdio.h> int main() { printf(" o \n"); printf("<H>\n"); printf("I I\n"); printf(" o \n"); printf("<H>\n"); printf("I I\n"); return 0; }

 

 

test1.2

#include<stdio.h>
int main()
{    
    printf(" o         o\n");
    printf("<H>        <H>\n");
    printf("I I        I I\n");
    return 0;

}

 

test2

#include<stdio.h>
int main()
{
    float a, b, c;
    scanf_s("%f%f%f", &a, &b, &c);
    if (a + b > c&& b + c > a&& a + c > b)
        printf("能构成三角形");
    else
        printf("不能构成三角形");
    return 0;
}

test3

#include<stdio.h>
int main()
{
    char ans1, ans2;
    printf("预习了没");
    ans1 = getchar();
    getchar();
    printf("\n实践了没");
    ans2 = getchar();
    if (ans1 == 'y' || 'Y' && ans2 == 'y' || 'Y')
        printf("good");
        else
        printf("666");
    return 0;
}

 

test4

 

#include<stdio.h>
int main()
{
    double x, y;
    char c1, c2, c3;
    int a1, a2, a3;
    scanf("%d%d%d", &a1, &a2, &a3);
    printf("a1 = %d, a2 = %d, a3 = %d\n", a1, a2, a3);
    scanf("%c%c%c", &c1, &c2, &c3);
    printf("c1 = %c, c2 = %c, c3 = %c\n", c1, c2, c3);

    scanf("%lf,%lf", &x, &y);
    printf("x = %lf, y = %lf\n", x, y);

    return 0;
}

 

 

test5

 

#include <stdio.h>
int main()
{
    int year;
    int sec;
    scanf_s("%d", &sec);
    year = sec / (60*60*24*365);
    if(sec % (60 * 60 * 24 * 365)>=(30*60*24*365))
    {
        year += 1;
    }
    printf("10亿秒约等于%d年\n", year);
    return 0;
}

 

 

test6.1

 

 

#include <stdio.h>
#include <math.h>
int main()
{
    double x, ans;
    scanf_s("%lf", &x);
    ans = pow(x, 365);
    printf("%.2f的365次方: %.2f\n", x, ans);
    return 0;
}

 

test6.2

 

#include <stdio.h>
#include <math.h>
int main()
{
    double x, ans;
    while (scanf_s("%lf", &x) != EOF)
    {
        ans = pow(x, 365);
        printf("%.2f的365次方: %.2f\n", x, ans);
        printf("\n");
    }
    return 0;
}

 

 

test7

#include<stdio.h>
int main()
{
    double f;
    double c;
    while (scanf_s("%lf", &c) != EOF)
    {
        f = 9 * c / 5 + 32;
        printf("摄氏度c=%.2f时,华氏度f=%.2f", c, f);
    }
    return 0;
}

 

 

test8

 

#include<stdio.h>
#include<math.h>
int main()
{
    double a, b, c, s,area;
    while (scanf_s("%lf%lf%lf", &a, &b, &c) != EOF)
    {
        s = (a + b + c) / 2;
        area = sqrt(s * (s - a) * (s - b) * (s - c));
        printf("a =%.0f,b=%.0f,c=%.0f,area=%.3f", a, b, c,area);

    }
    return 0;
}

 

标签:main,%.,return,int,实验,printf,include
From: https://www.cnblogs.com/lycxt/p/17745772.html

相关文章

  • 奇墨科技成功入选中国信通院稳定性保障实验室理事单位
    日前,奇墨科技正式入选中国信通院稳定性保障实验室理事单位,携手中国信通院共同推动我国系统稳定性保障能力建设,为千行百业企业的系统稳定性护航。成功入选[稳定性保障实验室理事单位]!参编多项行业标准近年来,随着各个领域数字化转型推进,数据系统应用范围不断扩大,承载业务愈发关键,用户......
  • 实验一
    #include<stdio.h>intmain(){printf("0\n");printf("<H>\n");printf("II\n");printf("0\n");printf("<H>\n");printf("II\n");return......
  • 实验1
    1//打印一个字符小人23#include<stdio.h>4intmain()5{6printf("o\n");7printf("<H>\n");8printf("II\n");9printf("o\n");10printf("<H>\n");11......
  • 实验1
    实验1#include<stdio.h>intmain(){printf("0\n");printf("<H>\n");printf("II\n");printf("0\n");printf("<H>\n");printf("II\n");re......
  • 实验1
    一)code11#include<stdio.h>2intmain()3{4printf("O\n");5printf("<H>\n");6printf("II\n");7printf("O\n");8printf("<H>\n");9printf("II\n");......
  • 实验1C语言输入输出和简单程序编写
    实验任务1task1.c源代码:1//打印一个字符小人23#include<stdio.h>4intmain()5{6printf("0\n");7printf("<H>\n");8printf("II\n");91011return0;12} 运行截图:task1_1.c源代......
  • 实验1
    实验1实验一源码#include<stdio.h>intmain(){printf("O\n");printf("<H>\n");printf("II\n");return0;}实验一结果实验1.1源码#include<stdio.h>intmain(){printf("O\n"......
  • 实验一
    实验一代码1结果1   代码2  结果2 实验二代码结果实验三代码 结果实验四代码结果实验五代码 #include<stdio.h>intmain(){ intyear; doubles; s=1000000000; year=s/60/60/24/365+0.5; printf("等于%d年\n",year); retu......
  • 实验1 C语言输入输出和简单程序编写
    一1_1.c1#include<stdio.h>23intmain()4{5printf("o\n");6printf("<H>\n");7printf("II\n");8printf("o\n");9printf("<H>\n");10......
  • 实验1
    一.实验任务11.11#include<stdio.h>2intmain()3{4printf("O\n");5printf("<H>\n");6printf("II\n");78return0;9}截图11.21#include<stdio.h>2intmain()3{4printf("O......