Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

** BETA TESTING ** I want some people to test a program I wrote for another person on here. beware it only works on windows and i am not really a programmer

OpenStudy (anonymous):

@echo off :: Take X Y and Z and output the largest odd number script by EMOTICON :D :: BTW I'm not really a computer programmer, but this does work :3 :: This program does not behave properly if spaces are entered in the prompts :: This program DOES behave properly by ignoring strings though :: Ask for user input. set /p x="What is X? " set /p y="What is Y? " set /p z="What is Z? " :: Check odd numbers set /a modulo = "%x% %% 2" if %modulo% == 0 ( set xo=false ) else ( set xo=true ) set /a modulo = "%y% %% 2" if %modulo% == 0 ( set yo=false ) else ( set yo=true ) set /a modulo = "%z% %% 2" if %modulo% == 0 ( set zo=false ) else ( set zo=true ) :: find largest number if %xo%==true echo "%x%">Num.temp if %yo%==true echo "%y%">Num.temp if %zo%==true echo "%z%">Num.temp if not exist Num.temp goto even findStr /R "[0-9]" "Num.temp">FindStr.temp del Num.temp for /F "tokens=*" %%a In (FindStr.temp) Do Call :odd %%a del FindStr.temp exit /B :odd set num=%1 set num=%num:"=% :: IF YOU WANT JUST A NUMBER AS OUTPUT, COMMENT THE "IF" COMMANDS AND UNCOMMENT "echo %num%" :: IF YOU WANT A USER FRIENDLY OUTPUT COMMENT "echo %num%" AND UNCOMMENT THE "IF" COMMANDS :: echo %num% if %x%==%num% (echo The largest odd number is X! [%num%]) if %y%==%num% (echo The largest odd number is Y! [%num%]) if %z%==%num% (echo The largest odd number is Z! [%num%]) pause exit /B :even echo All of these numbers are even and/or not numbers! pause exit /B

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!