#include <stdio.h>
#include <math.h>
main(){
int m,n,a=1,b,x,m1,n1,m2,n2;
printf("请输入M的值");
scanf("%d",&m);
printf("请输入N的值");
scanf("%d",&n);
m1=m%a;
n1=n%a;
m2=m;
n2=n;
while
(m1==0&&n1==0)
{x=a;
a=a+1;
m1=m%a;
n1=n%a;}
while
(m1!=0||n1!=0)
{a=a+1;
m1=m%a;
n1=n%a;}
if (m2<a||n2<a)
{printf("最大公约数为%d",x);
b=m*n/x;
printf("最小公倍数为%d",b);
return 0;}
}
#include <math.h>
#include <stdio.h>
main(){
int i,j,k,sum=0,count=0;
for(i=1000;i>=2;i=i-1)
{k=sqrt(i);
for(j=2;j<=k;j=j+1)
{if(i%j==0)
break;}
if(j>k)
{printf("%d\t",i);
sum=sum+i;
count=count+1;}
if(count>=10)
break;
}
printf("sum=%d\n",sum);
}
==========================================================================================
#include<stdio.h>
main(){
printf("请输入一段字符串:\n");
int alph=0,capital=0,num=0,space=0,other=0;
char c;
while ((c=getchar())!='\n')
{if (c>='a'&&c<='z')
alph++;
else
if (c>='A'&&c<='Z')
capital++;
else
if (c>='0'&& c<='9')
num++;
else
if (c==' ')
space++;
else
other ++;
}
printf("\n您输入的字符串中共有%d个小写字母、%d个大写字母、%d个空格以及%d个数字。\n",alph,capital,space,num);
if (other!=0)
printf("还有%d个字符我不认识,或许是符号。\n",other);
printf("\n20133017\n");
}