首页 > 其他分享 >实验一

实验一

时间:2024-09-29 22:13:53浏览次数:8  
标签:lf include return int 实验 printf main

实验一

横排

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

 

 

 

竖排

 #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;
     
  } 

任务二

#include <stdio.h>
#include <stdlib.h>
int main()
{
    double a,b,c;
    
    
    scanf("%lf%lf%lf",&a,&b,&c);
    
    
    if(abs(a-c)<b&&b<abs(a+c))
            printf("能构成三角形\n");
    else
            printf("不能构成三角形\n");
            
            
        return 0;
        
}

实验三

#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((ans1=='y'||ans1=='Y')&&(ans2=='y'||ans2=='Y'))            
            printf("\n罗马不是一天建成的,继续保持哦:)\n");
        else
            printf("\n罗马不是一天毁灭的,我们来建设吧\n");
    
        return 0;

 

回答问题

删去第九行后运行失败,问题二无法回答,删去第九行,问题二没有输入

实验四

#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,a1=%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;
}

实验五

#include <stdio.h> 

int main()
{
        int year;
        
        year=0.5+1000000000.0/(60*60*24*365);
        
        printf("10亿秒约等于%d年\n",year);
        return 0;
        
}

实验六

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

int main()
{
    double x,ans;
    
    while(scanf("%lf",&x) !=EOF)
    {
        ans=pow(x,365);
        printf("%.2f的365次方:%.2f\n",x,ans);
        printf("\n");
    }
    return 0;
}

实验七

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

实验八

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

 

标签:lf,include,return,int,实验,printf,main
From: https://www.cnblogs.com/limo2024/p/18440851

相关文章

  • 实验1
    任务1源代码1//打印一个小人#include<stdio.h>intmain(){ printf("0\n"); printf("<H>\n"); printf("II\n"); printf("0\n"); printf("<H>\n"); printf("II\n"); return0;} 运行结果 源......
  • 实验1
    任务1:1#include<stdio.h>2intmain()3{4printf("O\n");5printf("<H>\n");6printf("II\n");7printf("O\n");8printf("<H>\n");9printf("II\n"......
  • 实验1
    实验1任务1:打印小人源代码:#define_CRT_SECURE_NO_WARNINGS#include<stdio.h>intmain(){inti;for(inti=0;i<2;i++){printf("O\n");printf("<H>\n");printf("II\n");}......
  • 刘思含实验一
    test实验任务1源代码#include<stdio.h>intmain(){   printf("oo\n");   printf("<H><H>\n");   printf("IIII\n");   return0;}运行结果 源代码#include<stdio.h>intmain(){printf(&quo......
  • 实验1_C语言输入输出和简单程序应用编程
    task.1//打印一个字符小人#include<stdio.h>intmain(){printf("O\n");printf("<H>\n");printf("II\n");return0;}  task.1-1&1-2#include<stdio.h>intmain(){printf(&qu......
  • 实验1
    task.1_1代码:垂直方向:#include<stdio.h>intmain(){ printf("O\n"); printf("<H>\n"); printf("II\n"); printf("O\n"); printf("<H>\n"); printf("II\n"); return0;}......
  • 【LVIO-SLAM】Mars 实验室研究:FAST-LIO、FAST-LIO2、MLCC、HBA、Livox Camera Calibra
    【LVIO-SLAM】Mars实验室:多传感器融合分享笔记1.小结1.FAST-LIO2.FAST-LIO23.MLCC(Multi-LiDARCalibratedConsistency)4.HBA(HierarchicalBundleAdjustment)5.LivoxCameraCalibration(Livox_camera_calib)6.VoxelMap7.LI-init(LiDAR-InertialInitialization)2.......
  • 实验一
    #include<stdio.h>intmain(){printf("o\n");printf("<H>\n");printf("II\n");printf("o\n");printf("<H>\n");printf("II\n");return0;}......
  • 实验一
    task1_1 1#include<stdio.h>2intmain()3{4printf("o\n");5printf("<H>\n");6printf("II\n");7printf("o\n");8printf("<H>\n");9pri......
  • 实验1 C语言输入输出和简单程序编写
    task11#include<stdio.h>2intmain()3{4printf("0\n");5printf("<H>\n");6printf("II\n");7return0;8}   task1_1.c1#include<stdio.h>2intmain()3{4int......