第一题

代码

#include<stdio.h>
int main(){
    int a=0;
    int b=0;
    int sum=0;
    printf("请输入两个整数:\n");
    scanf("%d%d",&a,&b);
    sum=a+b;
    printf("%d\n",sum);
    return 0;

}

运行结果:

第二题:

代码

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

运行结果

第三题

代码

#include<stdio.h>
int main(){
    int b,h;
    double a;
    h=150*2/15;
    a=(15+25)*h/2;
    printf("%.2lf\n",a);
    return 0;
}

运行结果:

第四题

代码

//  导入标准输入输出函数库
#include"stdio.h"
// 定义主函数
int main()
// 函数体
{
    // 输出二元一次方程的结构
    printf("STRUCT\n");
    printf("        ax+by=c\n");
    printf("        dx+ey=f\n");
 
// 定义变量
    float a,b,c;
    float d,e,f;
// 输入a,b,c,d,e,f的值
    printf("Input a\n:");
    scanf("%f",&a);
    printf("Input b\n:");
    scanf("%f",&b);
    printf("Input c\n:");
    scanf("%f",&c);
    printf("Input d\n:");
    scanf("%f",&d);
    printf("Input e\n:");
    scanf("%f",&e);
    printf("Input f\n:");
    scanf("%f",&f);
 
// 定义x,y
    float x,y;
// 通过公式计算x的值
    x=(b*f-e*c)/(d*b-e*a);
// 输出x的解
    printf("The x is :%f\n",x);
    // 计算y的解
    y=(c-a*x)/b;
    // 输出y的解
    printf("The y is :%f\n",y);
// main函数结束,返回0,否则返回其他的值
    return 0;
 
}

运行结果:

第五题

代码

#include <stdio.h>
int main(){
  int a, b, c; 	
  scanf("%d%d%d", &a, &b, &c);
  printf("%8d %8d %8d", a, b, c);
  return 0;
}

运行结果

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐