专门网站建设北京百度推广优化公司
前言
大家好,今天带来一篇新的专栏c_牛客,不出意外的话每天更新十道题,难度也是从易到难,自己复习的同时也希望能帮助到大家,题目答案会根据我所学到的知识提供最优解。
🏡个人主页:悲伤的猪大肠9的博客_CSDN博客-C语言,汇编领域博主
✨✨✨✨如果文章对你有帮助记得点赞收藏关注哦!!✨✨✨✨
题目来源:牛客网
编程语言初学训练营_在线编程+题解_牛客题霸_牛客网 (nowcoder.com)
文章目录
- 前言
 - BC1 实践出真知
 - BC2 我是大V
 - BC3 有容乃大
 - BC6 小飞机
 - BC7 缩短二进制
 - BC8 十六进制转十进制
 - BC9 printf的返回值
 - BC10 成绩输入输出
 - BC11 学生基本信息输入输出
 - BC3 有容乃大
 - 完结
 
BC1 实践出真知
题目:

代码实现:
#include <stdio.h>int main() {printf("Practice makes perfect!");
}
 
BC2 我是大V
题目:

代码实现:
#include <stdio.h>int main() {printf("v   v\n");printf(" v v\n");printf("  v");
}
 
BC3 有容乃大
题目:

答案:
#include <stdio.h>int main() {printf("The size of short is %ld bytes.\n",sizeof(short));printf("The size of int is %ld bytes.\n",sizeof(int));printf("The size of long is %ld bytes.\n",sizeof(long));printf("The size of long long is %ld bytes.\n",sizeof(long long));
}
 
BC6 小飞机
题目:

答案:
#include <stdio.h>int main(){printf("     **     \n");printf("     **     \n");printf("************\n");printf("************\n");printf("    *  *    \n");printf("    *  *    \n");return 0;
}
 
BC7 缩短二进制
题目:
 
答案:
#include <stdio.h>int main() {int a = 1234;printf("%#o ",a);		printf("%#X",a);	//这里使用大写X打印十六进制字母的就是大写,小写x打印的十六进制字母就是小写
}
 
BC8 十六进制转十进制
题目:

答案:
#include <stdio.h>int main() {int a = 0xABCDEF;printf("%15d",a);
}
 
BC9 printf的返回值
题目:

答案:
#include <stdio.h>int main() {int ret = printf("Hello world!");printf("\n");printf("%d",ret);
}
 
BC10 成绩输入输出
题目:

答案:
#include <stdio.h>int main() {int a,b,c;scanf("%d %d %d",&a,&b,&c);printf("score1=%d,score2=%d,score3=%d",a,b,c); 
}
 
BC11 学生基本信息输入输出
题目:

答案:
#include <stdio.h>int main() {int num;float a,b,c;scanf("%d;%f,%f,%f",&num,&a,&b,&c);printf("The each subject score of No. %d is %.2f, %.2f, %.2f.",num,a,b,c);
}
 
BC3 有容乃大
题目:

答案1:
#include <stdio.h>int main() {		//由于题目给定五行所以可以直接打印,当然也可以使用循环char n;scanf("%c",&n);printf("    %c\n",n);printf("   %c %c\n",n,n);printf("  %c %c %c\n",n,n,n);printf(" %c %c %c %c\n",n,n,n,n);printf("%c %c %c %c %c\n",n,n,n,n,n);
}
 
答案2:
#include <stdio.h>int main() {char n;scanf("%c",&n);for(int i=0;i<5;i++){for(int j=0;j<4-i;j++){printf(" ");}for(int j=0;j<i+1;j++){printf("%c ",n);}printf("\n");}
}
 
完结
创作不易,还请各位小伙伴多多点赞👍关注✨收藏⭐

