首页 > 其他分享 >实验一

实验一

时间:2023-10-07 09:00:27浏览次数:29  
标签:main return int double 实验 printf include

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

 

test1.2

 

#include <stdio.h>

int main()
{
    float a,b,c;
    scanf("%f%f%f",&a,&b,&c);
    if (a+b>c&&a+c>b&&c+b>a)
        printf("能构成一个三角形\n");
    else
        printf("不能构成一个三角形\n");

    return 0;
}   
test2

#include <stdio.h>
int main()
{
    char ans1, ans2; 
    printf("每次课前认真预习、课后及时复习了没? (输入y或Y表示有,输入n或N表示没有) :");
    ans1 = getchar(); 
    getchar(); 
    printf("\n动手敲代码实践了没? (输入y或Y表示敲了,输入n或N表示木有敲) : ");
    ans2 = getchar();
    if ((ans2 == 'y' && ans1 == 'y') ||
        (ans1 == 'Y' && ans2 == 'Y') ||
        (ans1 == 'Y' && ans2 == 'y') ||
        (ans1 == 'y' && ans2 == 'Y')) //
        printf("\n罗马不是一天建成的, 继续保持哦:)\n");
    else
        printf("\n罗马不是一天毁灭的, 我们来建设吧\n");
    system("pause");
    return 0;
}
test3 test4
test5
#include <stdio.h>
int main()
{
    int year;

    const double second = 1e9;
    double temp = ((second / 3600) / 24) / 365;
    if (temp - (int)temp < 0.5) {
        year = (int)temp;
    }
    else {
        year = (int)temp + 1;
    }

    printf("10亿秒约等于%d年\n", year);
    system("pause");
    return 0;
}

 

test6
1 #include <stdio.h>
 2 #include <math.h>
 3 int main()
 4 {
 5     double x, ans;
 6     while (scanf("%lf", &x) != EOF) {
 7         ans = pow(x, 365);
 8         printf("%.2f的365次方: %.2f\n", x, ans);
 9         printf("\n");
10     }
11 
12     return 0;
13 }

#include <stdio.h>

int main()
{
    double f;
    double c;

    while (scanf("%lf", &c) != EOF) {
        f = 9.0 / 5.0 * c + 32.0;
        printf("摄氏度c = %.2lf时, 华氏度f = %.2lf\n", c, f);
        printf("\n");
    }

    return 0;
}
test7

 

#include <stdio.h>
#include <math.h>

int main()
{
    double a, b, c;
    double s;
    double area;

    while (scanf("%lf %lf %lf", &a, &b, &c) != EOF) {
        s = (a + b + c) / 2;
        area = sqrt(s * (s - a) * (s - b) * (s - c));
        printf("a = %d, b = %d, c = %d, area = %.3lf\n", (int)a, (int)b, (int)c, area);
        printf("\n");
    }

    return 0;
}

 

标签:main,return,int,double,实验,printf,include
From: https://www.cnblogs.com/LHLH0512/p/17745228.html

相关文章

  • 实验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......
  • 实验1 C语言输入输出和简单程序编写
    实验1实验1-11//打印一个字符小人23#include<stdio.h>4intmain()5{6printf("O\n");7printf("<H>\n");8printf("II\n");9printf("O\n");10printf("<H>\......
  • 实验一
    实验一task1-1.c1#include<stdio.h>2intmain()3{4printf("O\n");5printf("<H>\n");6printf("II\n");7printf("O\n");8printf("<H>\n");9printf("II\n&quo......