dimanche 19 juillet 2020

Write a program that will take three integers as input and will print the second largest number

I have tried this program to take 3 integers and print the 2nd largest number:

#include<stdio.h>
int main()
{
    int a,b,c,max2;
    printf("Enter 3 integers: ");
    scanf("%d%d%d",&a,&b,&c);
    max2=a;
    if(a>b){
        max2=b;
        printf("")
    }
    return 0;
}

Now i am stuck here. I am unable to find the logic behind this code. What can I do?

Aucun commentaire:

Enregistrer un commentaire