Search
 
SCRIPT & CODE EXAMPLE
 

C

Highest integer among the four inputs in c

#include<stdio.h>

int getBest(int a, int b, int c, int d);

int main(void) {
    int a, b, c, d;

    printf("Enter a: ");
    scanf("%d", &a);

    printf("Enter b: ");
    scanf("%d", &b);

    printf("Enter c: ");
    scanf("%d", &c);

    printf("Enter d: ");
    scanf("%d", &d);

    int highest = getBest(a, b, c, d);

    printf("Highest integer = %d", highest);

    return 0;
}

int getBest(int a, int b, int c, int d){
  
  if ( !( a < b || a < c || a < d ) )
    {        
        return a;
    }        
    else if ( !( b < c || b < d ) )
    {        
        return b;
    }        
    else if ( !( c < d ) )
    {        
        return c;
    }        
    else 
    {        
        return d;
    }
}
Comment

PREVIOUS NEXT
Code Example
C :: how to only show tenths place in c 
C :: vscode how to output in seperate consile 
C :: how to change the smartart style to 3D polished in powerpoint 
C :: run a command in cmd with c 
C :: print in c 11111 00000 11111 00000 11111 
C :: semicolong after for() loop stackoverflow 
C :: main prototype 
C :: c %d 
C :: delimter in c 
C :: BST or NOT ?? 
C :: OpenDaylight maven settings 
C :: minimun number of moves in c 
C :: deepak 
C :: c math.h sqrt 
C :: Writing tests for API requests 
C :: converting time in c 
C :: c ausgabe von variablen 
C :: algorithm for sorting numbers in ascending order 
C :: lognormal distribution - matlab 
C :: String insertion into another string 
C :: how to turn off bash 
C :: snake spielen 
C :: change variable type in c 
C :: array of pointers to functions 
C :: c local variable 
Dart :: flutter validate email 
Dart :: text fieldform color flutter 
Dart :: bad state insecure http is not allowed flutter 
Dart :: add bg image to scaffold flutter 
Dart :: slice string dart 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =