• 5


    • #include<stdio.h>
      int main()
      {
          int fac(int n);
          int n,y;
          printf("input an integer number:");
          scanf("%d",&n);
          y=fac(n);
          printf("%d!=%d
      ",n,y);
          return 0;}
      int fac(int n)
      {
          int f;
          if(n<0)
              printf("n<0,data error!");
          else if(n==0||n==1)
              f=1;
          else f=fac(n-1)*n;
          return(f);
      }

      #include<stdio.h>
      #include<math.h>
      int main(){
          int max4(int a,int b,int c,int d);
          int a,b,c,d,max;
          printf("Please enter 4 interger numbers:");
          scanf("%d%d%d%d",&a,&b,&c,&d);
          max=max4(a,b,c,d);
          printf("max=%d
      ",max);
          return 0;}
      int max4(int a,int b,int c,int d)
      {
      int max2(int a,int b);
      int m;
      m=max2(a,b);
      m=max2(m,c);
      m=max2(m,d);
      return(m);
      }
      int max2(int a,int b)
      {
      if(a>=b)
      return a;
      else
      return b;
      }
      #include<stdio.h> #include<math.h> int add(int x,int y) { int s; s=x+y; return(s);} int minus(int x,int y) { int s; s=x-y; return(s);} int multip(int x,int y) { int s; s=x*y; return(s);} int quotient(int x,int y) { float s; s=x/y; return(s);} int main() { int add(int x,int y),minus(int x,int y),multip(int x,int y),quotient(int x,int y); int s1,s2,s3,s4,x,y; scanf("%d %d",&x,&y); s1=add(x,y); s2=minus(x,y); s3=multip(x,y); s4=quotient(x,y); printf("add=%d ",s1); printf("minus=%d ",s2); printf("multip=%d ",s3); printf("quotient=%f ",s4); return 0; }

    #include"stdio.h"
    #include"math.h"
    int prime(int a)
    {
        int i,k;
        k = (int)sqrt(double(a));
        for(i = 2;i<=k;i++)
        {
            if(a%i==0)
            {
                return 0;
            }
        }
        return 1;
    
    
    }
    int main()
    {
        int a;
        scanf("%d",&a);
        if(prime(a)==0)
        {
            printf("%d不是素数",a);
        }
        else
            printf("%d是素数",a);
        return 0;
    }

  • 相关阅读:
    Java1:Chapter2
    Java1:Chapter1
    Java1:Chapter11
    Java1:Chapter8
    Java1:Chapter6
    Android day 03
    Android day02
    Android day01
    二进制文件的读写
    字符流
  • 原文地址:https://www.cnblogs.com/p201821440020/p/10967647.html
Copyright © 2020-2023  润新知