Skip to content
Sign upLog in
← Back to Community

Please Solve the C programming Problem for me

Profile icon
mehedihassan9

write a C program that shows the output of the largest, Mid and Lowest number of three inputted numbers.

Input: (by user)
a = 15
b = 20
c = 19

Output:
b is the biggest number 20
c is the mid number 19
a is the lowest number 15

Voters
Profile icon
FannyQuispe
Profile icon
mehedihassan9
Comments
hotnewtop
Profile icon
ash15khng

We can't do the problem for you, but we can help you with some parts if you need help. Do you have any start yet?

Profile icon
mehedihassan9

i have done a little but it shows the first 2 answer largest and mid but the ans for the lowest is showing equal to the mid number every time....

@ash15khng

Profile icon
ash15khng

@mehedihassan9
Could you link a repl please thanks!

Profile icon
mehedihassan9

here it is

@ash15khng

Invalid image url

Profile icon
mehedihassan9

#include<stdio.h>

int main()
{
int a,b,c;
printf("please enter A:\n");
scanf("%d",&a);
printf("please enter B:\n");
scanf("%d",&b);
printf("please enter C:\n");
scanf("%d",&c);
//Biggest number
if(a>=b && a>=c){

printf("A is the Biggest number %d\n", a); } else if(b>=c && b>=a) { printf("b is the Biggest number %d\n", b); } else if(c>=a && c>=b) { printf("c is the Biggest number %d\n", c); } //Lowest number if(a<=b && a<=c){ printf("A is the Lowest number %d\n", a); } else if(b<=c && b<=a) { printf("b is the Lowest number %d\n", b); } else if(c<=a && c<=b) { printf("c is the Lowest number %d\n", c); }

//MId number
if(a>b && b<c)
{
printf(" b is the mid number %d\n",b);
}
else if(b>c && c<a)
{
printf(" c is the mid number %d\n",c);
}
else if(c>a && a<b)
{
printf(" a is the mid number %d\n",a);
}

return 0;

}

@mehedihassan9

Profile icon
firefish

@mehedihassan9
We want a link to the repl, not the actual code.

Profile icon
mehedihassan9

How to do that. I dont know. Can you please describe.

@johnstev111

Profile icon
mwilki7

@mehedihassan9

Go where your code is and copy the URL at the top of your browser:
image

Profile icon
Highwayman

@mwilki7
here I made one for him, it looks like it’s not actually in replit.
https://repl.it/@Highwayman/For-dude-with-c-problem-code-now-in-repl

Profile icon
mehedihassan9

okay but can you help to solve this?

@Highwayman

Profile icon
Highwayman

@mehedihassan9
probably? Haven’t looked yet one sec

Profile icon
Highwayman

@mehedihassan9
your only testing one possibility each time, and you also don’t account for the middle being equal to the smallest or the largest.

Profile icon
mehedihassan9

So, im new to programming, so dont know how to solve this?

@Highwayman

Profile icon
Highwayman

@mehedihassan9
so maybe something like this:
a < b < c
c < b < a

if( (a < b && b < c) || (c < b && b < a) ){ ... }
Profile icon
mehedihassan9

Thanks for being helpful. I will try this out.

@Highwayman

Profile icon
Highwayman

@mehedihassan9
👍