四、顺序结构

#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);  
    int a = n / 1000;   
    int b = (n / 100) % 10; 
    int c = (n / 10) % 10;   
    int d = n % 10;      
    
   
    printf("%d%d%d%d\n", d,c,b,a);
    
    return 0;
}

#include <stdio.h>
int main()
 {
    double K;
    scanf("%lf", &K);
    double C = K - 273.15;
    double F = C * 1.8;
    F = F + 32;
    printf("%.10lf\n", F);
    return 0;
}
#include <stdio.h>
#include <math.h> 

int main() {
    int x1, y1, x2, y2;
   
    scanf("%d %d", &x1, &y1);
    scanf("%d %d", &x2, &y2);
    
    
    int dx = abs(x1 - x2);
    int dy = abs(y1 - y2);
    
   
    double dM = dx + dy;
  
    double dE = sqrt(dx * dx + dy * dy);
   
    double delta = fabs(dM - dE);
    
    printf("%.6f\n", delta);
    
    return 0;
}

#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n); 
    
    int a = n % 10;
    int b = (n / 10) % 10;
    int c = (n / 100) % 10;
    int d = n / 1000;
   
    int sum = a + b + c + d;
    printf("%d\n", sum);
    
    return 0;
}

#include <stdio.h>

int main() {
    long long seconds; 
    scanf("%lld", &seconds);
    
    int hours = seconds / 3600;
    int remaining = seconds % 3600;
    int minutes = remaining / 60;
    int secs = remaining % 60;
    
    printf("%d %d %d\n", hours, minutes, secs);
    return 0;
}

#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    long long count = (long long)n * 1024 * 1024 / 4;
    printf("%lld\n", count);
    return 0;
}

#include <stdio.h>

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c); 
    
    int surface = 2 * (a*b + a*c + b*c);
    int volume = a * b * c;
    
    printf("%d\n%d\n", surface, volume);
    return 0;
}

 #include <stdio.h>

int main() {
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);
  
    int S = A * 0.2 + B * 0.3 + C * 0.5;
    printf("%d\n", S);
    return 0;
}

#include <stdio.h>

int main() {
    long long n;
    scanf("%lld", &n);
    long long sum = n * (n + 1) / 2;
    printf("%lld\n", sum);
    return 0;
}

全部评论

相关推荐

11-16 22:02
同济大学 C++
今天linux学习的内容,太枯燥了-&nbsp;vim的多种模式-&nbsp;Normal:长命令,短命令,-&nbsp;Insert:&nbsp;编辑文本-&nbsp;Visiual:&nbsp;选择文本-&nbsp;...-&nbsp;Normal模式下的命令:移动光标(h:左,k:下,j:上,l:右)-&nbsp;短命令,向上走几行,向下走几行:[n]+,&nbsp;[n]-&nbsp;没有中括号-&nbsp;移动到文本首行:gg,末行:G-&nbsp;行内移动:wb,WB-&nbsp;长命令&nbsp;:[n]&nbsp;|&nbsp;[n]G-&nbsp;行首:^-&nbsp;行尾:&nbsp;&nbsp;$-&nbsp;到达某个字符前面:&nbsp;t字符&nbsp;???-&nbsp;文本对象:-&nbsp;i(,i),&nbsp;a(,a)-&nbsp;i[,i],&nbsp;a[,a]-&nbsp;...-&nbsp;Ip,&nbsp;ap&nbsp;&nbsp;&nbsp;段落&nbsp;--边界空行-&nbsp;动作-&nbsp;&nbsp;d,&nbsp;y&nbsp;,c-&nbsp;&nbsp;p-&nbsp;&nbsp;u-&nbsp;&nbsp;[ctrl]&nbsp;+&nbsp;r-&nbsp;:/pattern(向下搜索):?pattern(向上搜索)&nbsp;&nbsp;:[范围]s/pattern/replace/[选项]&nbsp;g=global-&nbsp;gcc&nbsp;注释一行或者取消注释一行-&nbsp;代码对其:&nbsp;gg=G-&nbsp;对文件的操作-&nbsp;:write-&nbsp;:quite-&nbsp;:wq-&nbsp;:q!-&nbsp;多窗口-&nbsp;水平&nbsp;:split&nbsp;:new-&nbsp;竖直:&nbsp;vsplit&nbsp;:vnew-&nbsp;切换窗口&nbsp;[ctrl]&nbsp;+&nbsp;ww-&nbsp;退出窗口&nbsp;:q&nbsp;:qa&nbsp;:only-&nbsp;shell命令-&nbsp;linux结构-&nbsp;Kernel&nbsp;管理计算机硬件资源,为上层应用提供运行环境-&nbsp;系统调用:api-&nbsp;库函数:&nbsp;系统调用的封装-&nbsp;shell:命令解释器-&nbsp;具体的shell:&nbsp;sh,&nbsp;csh,&nbsp;bash,&nbsp;ksh,&nbsp;zsh-&nbsp;查看帮助手册:&nbsp;man&nbsp;[手册编号]&nbsp;词条-&nbsp;关机-&nbsp;&nbsp;shutdown&nbsp;-poweroff-&nbsp;&nbsp;shutdown&nbsp;-reboot-&nbsp;&nbsp;shutdown&nbsp;-halt-&nbsp;&nbsp;shutdown&nbsp;-c-&nbsp;用户子系统相关命令-&nbsp;查看cat/etc/passwd-&nbsp;添加useradd&nbsp;-m&nbsp;&nbsp;或者&nbsp;useradd&nbsp;-s&nbsp;/bin/bash-&nbsp;删除&nbsp;userdel&nbsp;-r-&nbsp;修改&nbsp;passwd-&nbsp;切换用户&nbsp;su-&nbsp;退除切换&nbsp;exit
移动求职进展汇总
点赞 评论 收藏
分享
11-13 10:35
已编辑
广东工业大学 Java
cvte 安卓开发 17*(13-16) 硕士其他
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务