Functions in C

Sort by

recency

|

831 Discussions

|

  • + 0 comments
    #include <stdio.h>
    int max_of_four(int a, int b, int c, int d) {
        int max = a;
        if (b > max) {
            max = b;
        }
        if (c > max) {
            max = c;
        }
        if (d > max) {
            max = d;
        }
        return max;
    }
    
    
    int main() {
        int a, b, c, d;
        scanf("%d %d %d %d", &a, &b, &c, &d);
        int ans = max_of_four(a, b, c, d);
        printf("%d", ans);
        
        return 0;
    }
    
  • + 0 comments

    include

    int max_of_four(int a, int b, int c, int d) { int max = a; if (b > max) { max = b; } if (c > max) { max = c; } if (d > max) { max = d; } return max; }

    int main() { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); int ans = max_of_four(a, b, c, d); printf("%d", ans);

    return 0;
    

    }

  • + 0 comments

    int max_of_four(int a,int b,int c, int d){ int max; if(a>b){ if(a>c){ max=(a>d)?a:d; } else { max=(c>d)?c:d; } } else if(b>c){ max=(b>d)?b:d; } else { max=(c>d)?c:d; } return max; }

  • + 0 comments

    int z[4]={e,f,j,k},g; g=z[0]; for (int i=0;i< 4;i++) { if (z[i]>g) { g=z[i]; } } return g;

  • + 0 comments

    Inat TV offers a diverse range of live channels, including sports, news, and movies, all in a user-friendly interface. It’s a cost-effective alternative to cable, frequently updated with fresh content. Compatible with various devices, Inat TV ensures you can enjoy your favorite shows anytime, anywhere.