当前位置:网站首页>C 语言入门(六)
C 语言入门(六)
2022-07-15 16:55:00 【InfoQ】
1.字符类型判断
Eupper#include<stdio.h>
#include<ctype.h>
int main()
{
char ch;
scanf("%c",&ch);
if(islower(ch))
printf("lower\n");
else if(isupper(ch))
printf("upper\n");
else if(isdigit(ch))
printf("digit\n");
else
printf("other\n");
return 0;
}2.判断水仙花数
153yes#include <stdio.h>
#include <stdlib.h>
int main()
{ int m,a,b,c;
scanf ("%d",&m);
a=m/100;
b=(m/10)%10;
c=m%10;
if(m==a*a*a+b*b*b+c*c*c){
printf("yes");
}
else{
printf("no");
}
return 0;
}3.I love 闰年!
2012Yes#include <stdio.h>
#include <stdlib.h>
int main()
{
int y;
scanf("%d",&y);
if(y%400==0||(y%4==0&&y%100!=0)){
printf("Yes\n");}
else
{
printf("No\n");
}
return 0;
}4.三角形判定
3 4 5Yes#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a+b>c&&a+c>b&&b+c>a)
{
printf("Yes");
}else
printf("No");
return 0;
}5.判断直角三角形
6 8 10yes#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a)
{
printf("yes");
}else
printf("no");
return 0;
}边栏推荐
- TP5的whereOr方法多条件存在
- php 生成excel表的2种方法
- 【DFT/FFT存在的问题---栅栏效应的解决手段】
- Compileflow Taobao Workflow Engine
- [interview must brush 101] hash
- Typec display solution Daquan ldr6290 single C-Port desktop display solution
- The most important diagram of machine learning, how to select the model sklearn structure diagram
- Redis installation & startup
- Markdown learning notes Chapter 2 basic grammar (displayed in non markdown editor)
- How Oracle escapes single quotation marks
猜你喜欢

Timesformer: can you understand video by transformer alone? Another attack of attention mechanism

The most important diagram of machine learning, how to select the model sklearn structure diagram

1-初识FPGA

【面试必刷101】双指针

Thumbnail image processing class library

TP5的whereOr方法多条件存在

rhcsa笔记二

非对称加密RSA与对称加密AES项目应用

The game console type-C scheme supports data transmission while charging

Rhcsa note 2
随机推荐
RuntimeWarning: overflow encountered in long_scalars h = 12.0 / (totaln * (totaln + 1)) * ssbn - 3
基于TaskScheduler和CronTask实现动态增删启停定时任务功能
Cron表达式使用
markdown学习笔记 第二章 基本语法 (markdown编辑器下显示)
Design and implementation of fingertip Roulette Games (uniapp implements wechat applet)
数据库存IP地址,用什么数据类型
60岁开发者的建议,尝试改变一下吧!
浅析PHP关键词替换的类(避免重复替换,保留与还原原始链接)
唐门暗器之私有云排名
[problems of dft/fft - solutions to fence effect]
60 year old developer's suggestion, try to change it!
CCTV hosts are using this wireless Lavalier microphone with fire
rhcsa笔记二
C语言 第六章 函数
(一)MATLAB基础知识
MySQL-mysql基础
C语言 第八章 数组
C语言 栈的顺序表实现
Typora changes text color and line breaks
Swin transformer, the best paper model of iccv 2021, finally started video