Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,874 members, 7,828,114 topics. Date: Wednesday, 15 May 2024 at 01:18 AM

As A Programmer, What Will Be The Output Of This Code? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / As A Programmer, What Will Be The Output Of This Code? (810 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)

(1) (Reply) (Go Down)

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 undecided
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:


i get get d picture, i tell you guy m sorry had to take it down.

Sure, erased it too smiley
Re: As A Programmer, What Will Be The Output Of This Code? by airsaylongcome: 7:22pm On Apr 14, 2023
CorrectionFLuid:
Omo nairaland is so poor in code formatting.

It isn’t. You don’t know how to format it



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" ) ;
}

1 Like

Re: As A Programmer, What Will Be The Output Of This Code? by CorrectionFLuid: 8:01pm On Apr 14, 2023
airsaylongcome:


It isn’t. You don’t know how to format it



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" ) ;
}


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:
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" ) ;
}

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:
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" ) ;
}


The output of this code would depend on the results of two functions: count_num_states_25p("Tinubu"wink and check_if_fct_25p("Tinubu"wink.

If count_num_states_25p("Tinubu"wink returns a value of 24 or greater (i.e. if Tinubu has won at least 24 states), and check_if_fct_25p("Tinubu"wink 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)

J2me Programmers / Javamail => Need Help / Visual Basic Help Needed

(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. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.