Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,205,836 members, 7,993,910 topics. Date: Monday, 04 November 2024 at 09:31 PM |
Nairaland Forum / Science/Technology / Programming / As A Programmer, What Will Be The Output Of This Code? (885 Views)
As A Programmer What Other Side Hustle Are You into As U Are Yet To Land A Job / I Asked Chatgpt To Write A Poem About Nairaland. Here's The Output / What Would Be The Output Of This JS Code (pics) (2) (3) (4)
As A Programmer, What Will Be The Output Of This Code? by CorrectionFLuid: 6:12pm On Apr 14, 2023 |
Assuming that count_num_states_25p() is a function that counts the number of states where a candidate got 25%, and check_if_fct_25p() is a function that checks if a presidential candidate got 25% in the fct, what would be the output of this code? if ( (count_num_states_25p("Tinubu" ) >= 24) && (check_if_fct_25p("Tinubu" ) == 1) ) { printf("Congratulations, you're the president elect.\n" ) ; } else { printf("Sorry, you lost.\n" ) ; } |
Re: As A Programmer, What Will Be The Output Of This Code? by CorrectionFLuid: 6:15pm On Apr 14, 2023 |
Omo nairaland is so poor in code formatting. 1 Like |
Re: As A Programmer, What Will Be The Output Of This Code? by BellaTheDuke: 6:38pm On Apr 14, 2023 |
. |
Re: As A Programmer, What Will Be The Output Of This Code? by JoyousFurnitire(m): 6:45pm On Apr 14, 2023 |
. |
Re: As A Programmer, What Will Be The Output Of This Code? by JoyousFurnitire(m): 6:46pm On Apr 14, 2023 |
It will output the if part of the block if there's a match and the else part if there's no match. Since you didn't provide data |
Re: As A Programmer, What Will Be The Output Of This Code? by BellaTheDuke: 6:48pm On Apr 14, 2023 |
. |
Re: As A Programmer, What Will Be The Output Of This Code? by JoyousFurnitire(m): 6:51pm On Apr 14, 2023 |
BellaTheDuke: Sure, erased it too |
Re: As A Programmer, What Will Be The Output Of This Code? by airsaylongcome: 7:22pm On Apr 14, 2023 |
CorrectionFLuid: It isn’t. You don’t know how to format it
1 Like |
Re: As A Programmer, What Will Be The Output Of This Code? by CorrectionFLuid: 8:01pm On Apr 14, 2023 |
airsaylongcome: Most people view on phones Already tried that, was worse than the unformatted one on mobile, just like yours ... So I went with the unformatted. Since most people would read this on a mobile phone |
Re: As A Programmer, What Will Be The Output Of This Code? by RenaissanceGuy: 8:41pm On Apr 14, 2023 |
This is just a code snippet, so it's impossible to know if your overall logic is correct. |
Re: As A Programmer, What Will Be The Output Of This Code? by Deicide: 9:00pm On Apr 14, 2023 |
What if Tinubu is spelt tinubu in some state? |
Re: As A Programmer, What Will Be The Output Of This Code? by sirwilson(m): 12:09am On Apr 15, 2023 |
This code won't run |
Re: As A Programmer, What Will Be The Output Of This Code? by Nobody: 4:10pm On Apr 15, 2023 |
CorrectionFLuid: Shit questions all the time... Some of Una deserve flogging |
Re: As A Programmer, What Will Be The Output Of This Code? by favourRN(m): 5:59pm On Apr 15, 2023 |
CorrectionFLuid: The output of this code would depend on the results of two functions: count_num_states_25p("Tinubu" and check_if_fct_25p("Tinubu". If count_num_states_25p("Tinubu" returns a value of 24 or greater (i.e. if Tinubu has won at least 24 states), and check_if_fct_25p("Tinubu" returns a value of 1 (i.e. if Tinubu has passed the constitutional requirements to become president), then the output would be: "Congratulations, you're the president elect." On the other hand, if either of these conditions is not met (i.e. Tinubu has won less than 24 states or has not passed the constitutional requirements to become president), then the output would be: "Sorry, you lost." |
Re: As A Programmer, What Will Be The Output Of This Code? by MrBroke(m): 1:04pm On Apr 21, 2023 |
Your code ain't correct. Error |
(1) (Reply)
Phone Computer Connection / I Need A Shell Account / Flash Drive (help)
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 18 |