#include <stdio.h> #include <math.h> int main(){ double h,c; double j,s; double a,b; scanf("%lf%lf",&a,&b); h=a+b; c=a-b; j=a*b; s=a/b; printf("%lf ",h); printf("%lf ",c); printf("%lf ",j); printf("%lf ",s); return 0;
#include <stdio.h> #include <math.h> int main(){ int a,b,m=0,n=0; scanf("%d",&a); for(b=2;b<a;b++){ if(a%b==0) m=m+1; else if(a%b!=0) n=n+1; } if(m!=0){ printf("a is not a prime "); }else if(n!=0){ printf("a is a prime "); } return 0; }
int max2(int a,int b) { if(a>=b) return a; else return b; } int max4(int a,int b,int c,int d) { int m,n; m=max2(a,b); n=max2(c,d); if(m>=n) return m; else return n; } #include <stdio.h> int main() { int a,b,c,d,max; scanf("%d%d%d%d",&a,&b,&c,&d); max=max4(a,b,c,d); printf("%d ",max); return 0; }
int ad(int n) { if(n==1||n==0) return 1; return n*ad(n-1); } #include<stdio.h> int main() { int n; scanf("%d",&n); printf("%d ",ad(n)); return 0; }