Zidane
IN THE TERMINAL
Zidane
enter the first number:34enter the second number:322 enter the third number:12max:322 middle:2756608min:0 arrangement of numbers: 322>2756608>0
Zidane
ı didnt wrıte these number
Zidane
it gaves random number from memory
Manav
How can i do i dont know
watch youtube vids on it, https://www.youtube.com/watch?v=oCS0kU5VFA4 or https://www.youtube.com/watch?v=l5RARzD4Nc4
Manav
it gaves random number from memory
you didn't initialize the numbers, i can't help you unless you share your code
Manav
or use godbolt.org and share the link here
Manav
oh wow
Zidane
ı cant send link
Zidane
delete last a
Manav
it's alright i got it
Zidane
did it work
Zidane
did you reach
Manav
you used else if for the third check haha, i was making a point by asking you that question
Manav
did you reach
gimme a second to run your code
Zidane
okey
Manav
okey
you have so many issues, lets go through them one by one
Zidane
Should i use just else
Manav
Should i use just else
yep, because you know number3 is the maximum because it'll be after the top two if else
Manav
so else is fine instead of if else, but that's not why you have an error
Manav
lemme paste your code here, formatted so we can talk about it
Manav
#include <stdio.h> #include <stdlib.h> int main() { int number1, number2, number3, max, middle, min; printf("enter the first number:"); scanf("%d", &number1;); printf("enter the second number:"); scanf("%d", &number2;); printf("enter the third number:"); scanf("%d", &number3;); if (number1 > number2 && number1 > number3) { max = number1; if (number2 > number3) { number2 = middle; number3 = min; } if (number3 > number2) { number2 = min; number3 = middle; } } else if (number2 > number1 && number2 > number3) { max = number2; if (number3 > number1) { number3 = middle; number1 = min; } else if (number1 > number3) { number3 = min; number1 = middle; } } else if (number3 > number1 && number3 > number2) { if (number2 > number1) { number2 = middle; number1 = min; } if (number1 > number2) { number1 = middle; number2 = min; } } printf("max:%d\n", max); printf("middle:%d\n", middle); printf("min:%d\n", min); printf("arrangement of numbers: %d>%d>%d", max, middle, min); return 0; }
Abhishek
I am 28 years old. I am beginner in programming. I want to build career in programming and designing.. can anyone help?🙏. is it possible for me to get into microsoft, google like company?
Zidane
no there is not in my code
Zidane
if you want chech first code
Manav
no there is not in my code
you sent me that pastebin, it was in there
Zidane
ı didint write
Zidane
the program pastebin does it automatically
Manav
the program pastebin does it automatically
It doesn't do anything automatically
Manav
I think you don't properly understand what an assignment operator does
Zidane
Okay, can I do some more research and write to you?
Manav
Okay, can I do some more research and write to you?
It's a simple fix, no need for any research
Manav
i'll ask you a few questions, just answer them and you'll see the issue
Zidane
okey
Manav
int x = 3; int y = 2; x = y; What is the value of x and y after this? Don't run it in code
Manav
If you don't know tell me, i am not taking your test or anything. I need to know how much you understand about assignment operations
Manav
after you answer me i'll ask one more question then explain what's wrong with your code
Zidane
X and y equil the 3
Zidane
2
Manav
x and y are both 2
Manav
2
yes, this is the problem you see
Zidane
I think it is not about my question
Manav
my second question, int x = 3; int y = 2; y = x; what about now?
Manav
Zidane
3?
Manav
3?
Correct, Why 3 why not 2?
Zidane
X on the left
Zidane
Y sorry
Zidane
Okeyy
Zidane
I thiink i understand
Manav
i think this code is wrong
Please follow the conversation, i pasted their code for them
Zidane
Middle=number2
Zidane
I supposed to do like that, m
Løstrëgõ
okay its not working what can ı do
assigning of value is from right to left
Zidane
?
Manav
I supposed to do like that, m
Ah yes, that was my mistake
Manav
I didn't look at it properly lol, well now you know
Løstrëgõ
okay its not working what can ı do
for eg:- a=10; b=a; value of b will be a or 10
Zidane
Yeah i guest know
Dim
доброго времени суток
Rose
доброго времени суток
User Dim has 1/2 warnings; be careful! Reason: non English
Løstrëgõ
Yeah i guest know
#include<stdio.h> #include<stdlib.h> int main() { int number1,number2,number3,max,middle,min; printf("enter the first number:"); scanf("%d",&number1); printf("enter the second number:"); scanf("%d",&number2); printf("enter the third number:"); scanf("%d",&number3); if(number1>number2 && number1>number3){ max=number1; if(number2>number3){ middle=number2; min=number3; } if(number3>number2){ min=number2; middle=number3; } }else if(number2>number1 && number2>number3){ max=number2; if(number3>number1){ middle=number3; min=number1; }else if(number1>number3){ min=number3; middle=number1; } }else{ max=number3; if(number2>number1){ middle=number2; min=number1; }else if(number1>number2){ middle=number1; min=number2; } } printf("max:%d\n",max); printf("middle:%d\n",middle); printf("min:%d\n",min); printf("arrangement of numbers: %d>%d>%d",max,middle,min); return 0; }
Løstrëgõ
Yeah i guest know
i fix your code
Zidane
i fix your code
I already fix, thanky you anyway