实验1C语言开发环境使用和数据类型、运算符、表达式
2024-08-27 11:45:25
# include <stdio.h>
int main()
{
char ch;
printf("输入一个字符:\n");
scanf("%c",&ch);
if(ch>='a'&&ch<='z')
ch=ch-'a'+'A';
printf("%c\n",ch);
return ;
}
#include <stdio.h>
int main() {
int days;
printf("输入一个整数: \n");
scanf("%d",&days); if(days>=&&days<=)
printf("workdays, fighting\n");
else if(days==||days==)
printf("weekend, relax~\n");
else
printf("Ooops, not in 1~7\n");
return ;
}
//关系运算和逻辑运算
# include<stdio.h>
int main()
{
int a=,b=,c=;
printf("%d,%d,%d,%d\n",a==b&&a==c,a!=b&&a!=c,a>=b&&a>=c,a<=b&&a<=c);
printf("%d,%d\n",a<=b||a>=c,a==b||b==c);
printf("%d,%d,%d,%d\n",!(a==b),!(a>=b),!(a>=c),!(a<=b));
return ;
}
/*Thhis is first C program*/
# include<stdio.h>
int main()
{
printf("headbchsajhcuiknlxkns");
return ;
}
/*求两个整数的乘积*/
# include<stdio.h>
int product(int,int);
int main(void)
{
int x,y,s;
scanf("%d %d",&x,&y);
s=product(x,y);
printf("The mul is:%d",s);
return ;
}
int product(int a,int b)
{
int mul;
mul=a*b;
return mul;
}
# include <stdio.h>
int main()
{
int x;
printf("输入一个整数: \n");
scanf("%d",&x); if(x%==)
printf("是奇数");
else
printf("是偶数");
return ;
}
/*整数相除*/
# include<stdio.h>
int main()
{
int a=,b=,c=,d,e,f;
d=a/b*c;
e=a*c/b;
f=c/b*a;
printf("d=%d,e=%d,f=%d\n",d,e,f);
return ;
}
/*自加、自减运算*/
# include<stdio.h>
int main()
{
int a=,b=;
printf("a++=%d\n",a++);
printf("a=%d\n",a);
printf("++b=%d\n",++b);
printf("b=%d\n",b);
return ;
}
最新文章
- Python学习总结14:时间模块datetime &; time &; calendar (一)
- 一个js搜索功能的实现
- VI经典插件ctags
- Giew与checkBox的结合
- c# 远程回收IIS应用池
- Delphi XE6调用javascript
- 如何收集 EBS 各种相关业务的表的数据
- [Node.js] 2、利用node-git-server快速搭建git服务器
- 腾讯云申请SSL证书与Nginx配置Https
- 记一次Dynamic Batching不生效的爬坑实例分析[Unity]
- [redis] <;<;The little Redis book>;>;的读书笔记
- node中中间件body-parser的实现方式
- HMM与分词、词性标注、命名实体识别
- Masonry插件:内容始终水平居中
- RNN - LSTM - GRU
- Dijkstra Java
- RN_ 错误整理
- 【Raspberry Pi】crontab 定时任务
- 【转】一看你就懂,超详细java中的ClassLoader详解
- pip镜像源