实验5
#include <stdio.h>
void jia(),jian(),chen(),chu();
int jia(int a,int b) { int c; c=a+b; return(c); };
int jian(int a,int b) { int c; c=a-b; return(c); };
int chen(int a,int b) { int c; c=a*b; return(c); };
int chu(int a,int b){ int c; c=a/b; return(c); };
int main(){
int a,b,d,e,f,g;
scanf("%d%d",&a,&b);
d=jia(a,b); e=jian(a,b); f=chen(a,b); g=chu(a,b);
printf("两个数的加减乘除是%d %d %d %d",d,e,f,g);
return 0;
}
#include <stdio.h>
void judge();
int judge(int a) {
int b,c;
c=1;
for(b=2;b<a;b++){ if(a%b==0) {c=0; break; } }
return c; };
int main(){
int a,d;
scanf("%d",&a);
d=judge(a);
if(d==1){ printf("这个数是素数"); }
if(d==0){ printf("这个数不是素数"); }
return 0;
}
#include <stdio.h>
int max2(int a,int b){
if(a>b) return a;
else if(a<b) return b; }
int max4(int a, int b, int c, int d){ return max2(max2(a,b),max2(c,d)); }
int main() { int a,b,c,d; scanf("%d%d%d%d",&a,&b,&c,&d);
printf("%d\n",max4(a,b,c,d));
return 0; }
#include <stdio.h>
int add(int n){
if(n == 1) return 1;
else return n*add(n-1); }
int main(int argc, char* argv[])
{ int n;
scanf("%d",&n);
printf("%d\n",add(n));
return 0;
}