You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
| 
				
					
						 | 
			4 years ago | |
|---|---|---|
| README.md | 4 years ago | |
| 判断数字类型 | 4 years ago | |
| 字符分类统计 | 4 years ago | |
| 打印菱形* | 4 years ago | |
| 斐波那契数列 | 4 years ago | |
		
			
				
				README.md
			
		
		
			
			
		
	
	//字符分类统计
#include<stdio.h>
int a=0,b=0,c=0,d=0,e=0;
void fun(char ch[])
{
	for(int i = 0; i < 10; i ++)
	{
		if(ch[i]>='A'&&ch[i]<='Z') a++;
		else if(ch[i]>='a'&&ch[i]<='z') b++;
		else if(ch[i]>='0'&&ch[i]<='9') c++;
		else if(ch[i]==' ')d++;
		else e++;
	}
}
int main()
{
	char ch[10];
	scanf("%s",ch);
	fun(ch);
	printf("majuscule=%d\nb=%d\nnum=%d\nblank=%d\nothers=%d",a,b,c,d,e);
	return 0;
} 
//判断数字类型
#include<stdio.h>
#include<math.h>
int fun(int a)
{
	int ans = 0;
	for(int i = 2; i <= sqrt(a); i++)
	{
		if(a%i==0)
		{
			ans = 1;
			break;
		}
	}
	return ans;
}
int main()
{
	int a;
	scanf("%d",&a);
	int ans = fun(a);
	if(ans == 1) printf("NO");
	else printf("YES");
}
//求斐波那契数列
#include<stdio.h>
int fib(int n)
{
	if(n==1||n==2) return 1;
	else return  fib(n-1)+fib(n-2);
}
int main()
{
	int n;
	scanf("%d",&n);
	int ans = 0;
	ans = fib(n);
	printf("%d",ans);
	return 0;
 } 
//打印*号
#include<stdio.h>
void Print(int m)
{
	for(int i = 1; i <= m; i ++)
	{
		printf("*");
	}
	for(int i = m-1; i >= 1; i --)
	{
		printf("*");
	}
}
void PrintSpace(int m)
{
	for(int i = 1; i <= m; i ++)
	{
		printf(" ");
	}
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 1; i <= n;i ++)
	{
		PrintSpace(n-i);
		Print(i);
		PrintSpace(n-i);
		printf("\n");
	}
	for(int i = n-1; i >=1;i--)
	{
		PrintSpace(n-i);
		Print(i);
		PrintSpace(n-i);
		printf("\n");
	}
	return 0;
}