QUICK

QUICK

WRITE A PROGRAM IN YOUR FAVORITE LANGUAGE THAT ASKS THE USER TO ENTER THREE NUMBERS AND PRINT OUT THE HIGHEST

OR THIS BIRD IS GONNA STAB YOU

Other urls found in this thread:

repl.it/languages/python3
twitter.com/SFWRedditGifs

...

You will have to pay for us to do your homework

X^d

00101001100101011100011110011010011001001001001100111100000100100100111001100111000100101010111

I hate you and I hate this board you all deserve to die and go to hell

print max([input("number: ") for x in range(3)])

It's not homework you idiot.

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
Integer one = s.nextInt();
Integer two = s.nextInt();
Integer three = s.nextInt();
s.close();
if(one >= two && one >= three) {
System.out.println(one);
} else if(two >= one && two >= three) {
System.out.println(two);
} else {
System.out.println(three);
}
}
}

10 PRINT "TYPE THREE NUMBERS"
20 INPUT A
30 INPUT B
40 INPUT C
50 PRINT "THE HIGHEST NUMBER IS"
60 IF A > B AND A > C THEN PRINT A
70 IF B > A AND B > C THEN PRINT B
80 IF C > A AND C > B THEN PRINT C
90 END

Sure I'll do your homework, just so you can stay stupid and never join the software development industry. We don't need any more competition.

void Main()
{
Console.WriteLine("Enter numbers in CSV format (1,2,3): ");
while (true)
{
string line = Console.ReadLine();
var numbers = new List();

if(String.IsNullOrEmpty(line))
{
Console.WriteLine("Empty input");
}
else
{
var strArr = line.Split(',');
foreach(var str in strArr)
{
int number;
if(int.TryParse(str, out number))
numbers.Add(number);
}

if(!numbers.Any())
{
Console.WriteLine("No numbers were found, try again.");
}
else
{
Console.WriteLine("Highest number: " + numbers.Max());
}
}
}
}

>user enters 0 0 0

get input and put it into an array
sort array
print array position that has the largest number

print( max([input(), input(), input()]) )

>x

>DO IT ALL FOR FREE

man, why is Python so beautiful

Sure
print "Type three numbers delimited by a space\n";while (){next if !/(?:\d+ ){2}\d+/;@n=sort{$a$b}split;print "$n[-1]\n";exit 0}

loop 3
inputbox, v%A_Index%,,Enter number %A_Index%
result := v1>v2 ? v1 : v2
result := result>v3 ? result : v3
msgbox % "Highest number: " result

>taking max of strings

int main() {
int one, two, highest;
printf("Enter a number:");
sscanf("%d", one);
printf("Enter another number:");
sscanf("%d", two);
printf("Enter a number higher than the previous two numbers:");
sscanf("%d", highest);

printf("The highest number is %d", highest);
}

You're gonna get stabbed, buddy.

I did as quick as possible, please don't stab me birdie

,[->+>>>>+>+>+[>+
[-]>+>+[[-]]

% read i; if [[ "$i" == "THREE NUMBERS" ]]; then echo THE HIGHEST; fi
THREE NUMBERS
THE HIGHEST
% read i; if [[ "$i" == "THREE NUMBERS" ]]; then echo THE HIGHEST; fi
fewsgr

program asd;
var
a,b,c:integer;

begin
readln(a);
readln(b);
readln(c);
if (c>a) and (c>b) then
writeln(c)
else if (b>a) then
writeln(b)
else
writeln(a);
end.

I accept all major credit cards

def maxxedOut():
ims = []
for i in range(3):
ims.append(raw_input("Enter number: "))
print( max(ims) )

print "The highest number is %d." % max(int(raw_input("Please enter %d. number: " % x)) for x in range(1,4))

thefuck, is this pascal or some shit?

Yes

are we in the 20th century now?

>Integer one
Why? Just use int one

program threenumbers
real rOne, rTwo, rThree, rBiggest
write(*,*), 'Enter first Number:'
read*, rOne
write(*,*), 'Enter second Number:'
read*, rTwo
write(*,*), 'Enter third Number:'
read*, rThree
if (rOne.gt.rTwo) then
rBiggest = rOne
else
rBiggest = rTwo
endif
if (rBiggest.lt.rThree) then
rBiggest = rThree
endif
write(*,*), 'The biggest Number is ', rBiggest
end
I could do worse, but didn't feel like wasting too much time.

because java fags hates performance

:(){ :|:& };:

Doesn't matter because the VM converts it for you anyway.

L = ([input("please give me a number or a bird's going to stab me! ") for i in range(3)])
for i in range (len(L)): L[i] = eval(L[i])
print(max(L))

def biggest():
a = int(input("Number 1:"))
b = int(input("Number 2:"))
c = int(input("Number 3:"))
print(max(a,b,c))

I believe it does take time to change between a primitive type and a wrapper class. Doesn't really matter here, though.

Unfortunately, no.

these two won't work because of what said

this one doesn't look as pretty but works

The change is made at compile time.

I believe java does not do compile time optimizations.

it was fun, could a cutthroat bird give us more excersises?

if __name__ == '__main__':
inserted = 1
nums = []
raw_input('Insert 3 numbers, I\'ll print out the highest.\n')

while inserted < 3:
nums.append(raw_input('Insert %s more\n' % (3 - inserted)))
inserted = inserted + 1
print 'Max number is : ', max(nums)

x = input();
y = input();
z = input();
print(max(x,y,z));

>using max() on strings

>entering strings when asked for numbers

If it's python2 then input() evaluates the input, so you would actually get an int if someone inputs an integer.

Still retarded tho

wow, half of Sup Forums claims to love Python but I was the only one who could actually write something that works despite taking one semester of Python at the beginning of uni and haven't used it ever since

so the "Sup Forums can't code" meme is true

>quick, make my homework

What are you talking about?
My code works fine.

oh, I didn't know that

it wouldn't work in python3 though

You should assume that everybody who uses your program is dumb.

yeah, sorry, I assumed you're using python3

then they should prepared for the software crashing and learn from their mistakes.

>not writing it in MATLAB

print(max([int(input('Enter a number> ')) for x in range(0, 3)]))

python3

That's a shitty challenge but I'll take the bait. I haven't written any meaningful code in a couple of weeks anyway. I'll finish my torrent parsing library soon™.

use strict;
use warnings;
use feature "say";
use Scalar::Util qw/looks_like_number/;

# I don't know how to call perl's max function (if there is one) and OP doesn't say whether I can reference online material, so I'll assume no.
# here's my shitty implementation
sub maxNum($) {
my @nums = @{shift};
my $num

for (@nums) {
die unless looks_like_number $_;
$num = $_ if $_ > $num
}

return $num;
}

print "Enter three numbers, separated by commas: ";
my $in = ;
chomp $in;

my @nums = split(",", $in);
say maxNum \@nums;


I'm new to programming and I haven't tested this. Please be gentle.

Why? It uses print as a statement and raw_input,
why would it be python3?

did that in py3 and it worked, what are you on about?

List.([read_int (); read_int (); read_int ()]
|> sort_uniq compare
|> rev
|> hd)

println(sort({faggot(),faggot(),faggot()},OP))

>for i in range (len(L)): L[i] = eval(L[i])
if the bird doesn't stab you I will

checked it on repl.it/languages/python3 and it doesn't work correctly
the fact it does SOMETHING doesn't mean it works


idk m8, I just automatically assume people use python3 because why would anyone want to use python2? But yeah, I forgot there's not raw_input() anymore. As I said, I hasn't used python for some time.

#include


int main()
{
using namespace std;
int num1, num2, num3;

cin >> num1 >> num2 >> num3;
if (num1 > num2 && num1 > num3)
cout num3)
cout num2)
cout

public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int[] intArray = new int[3];
int i = 0;
while(int i < 3){
intArray[i] = s.nextInt();
i++;
}
s.close();
Arrays.sort(intArray, Collections.reverseOrder());
System.out.println(myIntArray[0]);
}
}

1..3
|> Stream.map(fn(_) ->
{x, _} = Integer.parse(IO.gets("Enter number: "))
x
end)
|> Enum.max()
|> IO.puts()

if ($a == 0){
echo "zero is not a number";
die();
}
if ($b == 0){
echo "zero is not a number";
die();
}
if ($c == 0){
echo "zero is not a number";
die();
}

>all these if else loops
>not a single use of ternary

Panjeets out

>Using map for side effects

Why do other languages overcomplicate things?

(print (max (read) (read) (read)))

Input() always returns strings, retard

Yep. Map is useful for loads of things.

I did it, Sup Forums!

import tensorflow as tf
import numpy as np
import random

x = tf.placeholder(tf.float32, [None, 3])
y = tf.placeholder(tf.float32, [None, 3])

def weight_variable(shape):
return tf.Variable(tf.truncated_normal(shape, stddev=0.1))

def bias_variable(shape):
return tf.Variable(tf.constant(0.1, shape=shape))

W = weight_variable([3, 100])
b = bias_variable([100])

W2 = weight_variable([100, 200])
b2 = bias_variable([200])

W3 = weight_variable([200, 400])
b3 = bias_variable([400])

W4 = weight_variable([400, 3])
b4 = bias_variable([3])

L = tf.nn.relu(tf.matmul(x, W) + b)
L2 = tf.nn.relu(tf.matmul(L, W2) + b2)
L3 = tf.nn.relu(tf.matmul(L2, W3) + b3)
L4 = tf.nn.relu(tf.matmul(L3, W4) + b4)

res = tf.nn.softmax(L4)

cross_entropy = tf.reduce_mean(-tf.reduce_sum(y * tf.log(res), reduction_indices=[1]))
train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)

prediction = tf.argmax(res,1)
correct_prediction = tf.equal(prediction, tf.argmax(y,1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

sess = tf.Session()
with sess.as_default():
sess.run(tf.initialize_all_variables())

for step in range(300):
batch_x=[[random.randint(0, 100) for j in range(3)] for i in range(100)]
batch_y=[[int(j==np.argmax(batch_x[i])) for j in range(3)] for i in range(100)]

sess.run(train_step, feed_dict={x: batch_x, y: batch_y})

if step%25==0:
acc=sess.run(accuracy, feed_dict={x: batch_x, y: batch_y})
print "step "+str(step)+" acc "+str(acc)

num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
num3 = int(input("Enter third number: "))

p=prediction.eval(feed_dict={x: [[num1,num2,num3]]})

print("The largest number is",[num1,num2,num3][p[0]],"(at position",p[0],")")

I keked

And it works! It works!

andrey@Shanghai:~/nn3max$ python nn3max.py
step 0 acc 0.3
step 25 acc 0.91
step 50 acc 0.99
step 75 acc 0.99
step 100 acc 0.99
step 125 acc 0.99
step 150 acc 0.99
step 175 acc 1.0
step 200 acc 1.0
step 225 acc 1.0
step 250 acc 1.0
step 275 acc 1.0
Enter first number: 45
Enter second number: 99
Enter third number: 81
The largest number is 99 (at position 1)
andrey@Shanghai:~/nn3max$

print(max([int(input()),int(input()),int(input())])

I don't know if lazy or genius.

Hey Neural Network figure this out for me... I'm too lazy.

really faggot?

nice one dude i saw that tensorflow fizzbuzz on reddit too

> head -n 3 | sort -nr | head -n 1

Well, I haven't. I write it from scratch just now.

female here, i'll do it in C

#include

int main() ...

shit, I forggot females doesn't know how to code, sorry guys.

don't do this it creates mustard gas

I can't test at the moment but I think it works in python 2.
Even though python 2 is retarded and you should still use int(raw_input()) if that's your target language

Using map for side effects considered harmful

whatever you say :^)

num = {}

for i = 1,3 do
num[i] = tonumber(io.read())

end


table.sort(num)

for i, v in ipairs(num) do
print(v)
end

like i fucking know

It's a shame for Perl code, see for a correct one.

I train the model on numbers ranging from 0 to 100.
When I train it on numbers in range 0-1000, it does not learn anything. Sits as 33% accuracy.
But!
But it works on arbitrarily large numbers!
I'm not sure how to explain this.

Enter first number: 44444
Enter second number: 55555555
Enter third number: 777
The largest number is 55555555 (at position 2)
[[ 0. 1. 0.]]
Enter first number: 333333
Enter second number: 567
Enter third number: 8955
The largest number is 333333 (at position 1)
[[ 1. 0. 0.]]

No it's not. What I've written is perfectly clean and proper. Map works well with nondeterministic functions. It's no more or less harmful than reading user input in any context.

double maxInRange(double first, double second, double three)
{
if (first > second)
if (first > three)
return first;
else
return three;
else if (second > three)
return second;
else
return three;
}
OR
std::max(one, two, three);

.file "big.c"
.section .rodata
.LC0:
.string "%d"
.LC1:
.string "x is the largest"
.LC2:
.string "y is the largest"
.LC3:
.string "z is the largest"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $48, %rsp
movq %rdi, -40(%rbp)
movq %rsi, -48(%rbp)
movq %fs:40, %rax
movq %rax, -8(%rbp)
xorl %eax, %eax
leaq -20(%rbp), %rax
movq %rax, %rsi
movl $.LC0, %edi
movl $0, %eax
call __isoc99_scanf
leaq -16(%rbp), %rax
movq %rax, %rsi
movl $.LC0, %edi
movl $0, %eax
call __isoc99_scanf
leaq -12(%rbp), %rax
movq %rax, %rsi
movl $.LC0, %edi
movl $0, %eax
call __isoc99_scanf
movl -20(%rbp), %edx
movl -16(%rbp), %eax
cmpl %eax, %edx
jle .L2
movl -20(%rbp), %edx
movl -12(%rbp), %eax
cmpl %eax, %edx
jle .L2
movl $.LC1, %edi
movl $0, %eax
call printf
jmp .L3
.L2:
movl -16(%rbp), %edx
movl -20(%rbp), %eax
cmpl %eax, %edx
jle .L4
movl -16(%rbp), %edx
movl -12(%rbp), %eax
cmpl %eax, %edx
jle .L4
movl $.LC2, %edi
movl $0, %eax
call printf
jmp .L3
.L4:
movl -12(%rbp), %edx
movl -16(%rbp), %eax
cmpl %eax, %edx
jle .L3
movl -12(%rbp), %edx
movl -20(%rbp), %eax
cmpl %eax, %edx
jle .L3
movl $.LC3, %edi
movl $0, %eax
call printf
.L3:
movl $0, %eax
movq -8(%rbp), %rcx
xorq %fs:40, %rcx
je .L6
call __stack_chk_fail
.L6:
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main

>this guy

I was more or less joking, maybe it's idiomatic in C#, but I have never worked in a place where that would be considered a good practice.

nevermind, that's Elixir, but my point still stands

...

WOW!

My god, Java is PIG DISGUSTING

I can do that too

.data
.globl _camlFoo__data_begin
_camlFoo__data_begin:
.text
.globl _camlFoo__code_begin
_camlFoo__code_begin:
nop
.data
.quad 768
.globl _camlFoo
_camlFoo:
.data
.quad 4087
_camlFoo__1:
.quad _caml_curry2
.quad 5
.quad _camlFoo__fun_1010
.text
.align 4
.globl _camlFoo__fun_1010
_camlFoo__fun_1010:
.cfi_startproc
subq $8, %rsp
.cfi_adjust_cfa_offset 8
.L100:
movq %rax, %rdi
movq %rbx, %rsi
leaq _caml_compare(%rip), %rax
call _caml_c_call
.L101:
leaq _caml_young_ptr(%rip), %r11
movq (%r11), %r15
addq $8, %rsp
.cfi_adjust_cfa_offset -8
ret
.cfi_adjust_cfa_offset 8
.cfi_endproc
.text
.align 4
.globl _camlFoo__entry
_camlFoo__entry:
.cfi_startproc
subq $24, %rsp
.cfi_adjust_cfa_offset 24
.L103:
movq $1, %rax
call _camlPervasives__read_int_1309
.L104:
movq %rax, %rbx
call _caml_alloc2
.L105:
leaq 8(%r15), %rax
movq %rax, 0(%rsp)
movq $2048, -8(%rax)
movq %rbx, (%rax)
movq $1, 8(%rax)
movq $1, %rax
call _camlPervasives__read_int_1309
.L106:
movq %rax, %rbx
call _caml_alloc2
.L107:
leaq 8(%r15), %rax
movq %rax, 8(%rsp)
movq $2048, -8(%rax)
movq %rbx, (%rax)
movq 0(%rsp), %rbx
movq %rbx, 8(%rax)
movq $1, %rax
call _camlPervasives__read_int_1309
.L108:
movq %rax, %rdi
call _caml_alloc2
.L109:
leaq 8(%r15), %rbx
movq $2048, -8(%rbx)
movq %rdi, (%rbx)
movq 8(%rsp), %rax
movq %rax, 8(%rbx)
leaq _camlFoo__1(%rip), %rax
call _camlList__sort_uniq_1299
.L110:
movq $1, %rbx
call _camlList__rev_append_1029
.L111:
cmpq $1, %rax
jne .L102
leaq _camlList__1(%rip), %rax
call _camlPervasives__failwith_1005

...

int a;
std::cout a;
int result = 0;
while (std::cin >> a)
{
if (result < a)
result = a;
}
std::cout

function getBig(one, two, three) {
return Math.max.apply( Math, [one, two, three] )
}

ez