I wrote my first software today. I think I am ready for the technical interview

I wrote my first software today. I think I am ready for the technical interview.

#include

int main (){

int i;

for (i = 0; i < 101; i++){
if ((i % 3 == 0) && (i % 5 == 0) && (i !=0)){
printf ("Fizz Buzz");
}
if ((i % 3 == 0) && (i !=0)){
printf ("Fizz");
}
if ((i % 5 == 0) && (i !=0)){
printf ("Buzz");
}
else {
printf ("%d\n", i);
}

system ("pause");
return 0;

}

Attached: thumb_hacker-voice-im-in-world-meme-database-ld-30012975.png (200x184, 19K)

yeah shit code, not hired

sage

Why are you downsaging my thread?

because it is shit code nor funny

sage

What is wrong with the code bro? Can you do better?

What did you expect from this place

I remember my first day in intro to programming too :)

15 will print FizzBuzz, Fizz, and Buzz. You failed FizzBuzz.

Good job, you wrote a bunch of gibberish. Are you proud of yourself ?

pause: not found

you have a syntax error.

string a="op";

switch(a) {
case "op": printf("neck") break;
default: printf(a + "is a faggot"); break;
}

It's not in a code box

import sys
for op in range(1, 101):
op_is_a_faggot = op % 3 == 0
op_sucks_ladycock = op % 5 == 0
op_takes_it_up_the_ass = not op % 3 == 0 and not op % 5 == 0
if op_is_a_faggot:
sys.stdout.write('Fizz')
if op_sucks_ladycock:
sys.stdout.write('Buzz')
if op_takes_it_up_the_ass:
sys.stdout.write(str(op))
sys.stdout.write('\n')
sys.stdout.flush()

Attached: 551533e65c981a06f87f5d85e022bbb9305ad556400b41d3887cb8cf60c4cc17.png (1142x480, 34K)

I forgot to put "else if" for the conditional statements following the first if. I also forgot to put \n after Fizz Buzz, Fizz, and Buzz. Also I forgot to close the curly bracket in the loop.

I am self taught bro. Do you think I have a chance to work at goggle?

>system("pause")

Attached: faggot_detected.jpg (377x421, 36K)

Why?

>Do you think I have a chance to work at goggle?

No. Infosys might take you.

Any common multiple of 3 and 5 will output Fizz Buzz, Fizz and Buzz. You don't need three conditionals. Just one for modulo 3, one for modulo 5 and modified handling of print statements.

Also, is this not bait?

>system("pause")
i bet it took you more time to load up your IDE than it took for you to write that joke of a program

See

What is wrong with pausing the system please?

I fixed my app guys it should work now!
#include

int main (){

int i;

for (i = 0; i < 101; i++){
if ((i % 3 == 0) && (i % 5 == 0) && (i !=0)){
printf ("Fizz Buzz\n");
}
else if ((i % 3 == 0) && (i !=0)){
printf ("Fizz\n");
}
else if ((i % 5 == 0) && (i !=0)){
printf ("Buzz\n");
}
else {
printf ("%d\n", i);
}
}

system ("pause");
return 0;

}

you still don't need three conditionals; two would suffice.

It ("pause" parameter) is platform specific; It's also not in stdio.h.

for (int i = 1; i

Two conditionals. Like

Mommy noooooooo

Attached: 1535412664126-g.gif (480x270, 1.11M)

bash: pause: command not found

Same line bracing can actually get you fired in some places I've seen

I would need to make an array with a varying set of elements but then I'd still end up with a bunch of condotional statements to control what's in the array for a given instance.

Why is he looking at backwards text on his monitor?

Syntax error on line 4.

you're hired

Faag

No you wouldn't Look at .
Start from one. Simply move the newline character to after all conditionals have evaluated. Then evaluate modulo 3 (if == 0, output 'fizz'), modulo 5 (if == 0, output 'buzz'), else output the number. Then newline.

For a common multiple of 3 and 5 like 15, this would output 'fizz' (after modulo 3 evaluation) and 'buzz' (after modulo 5 evaluation) for 'fizz buzz' in total.

static const char *out[] = {
"", "", "fizz", "", "buzz",
"fizz", "", "", "fizz", "buzz",
"", "fizz", "", "buzz", "fizzbuzz",
};
for (int i = 1; i

>system ("pause");
dropped. Don't call me, we'll call you.

> system("pause");
Install gentoo

Was that written in C#? Similar methodology doesn't work in C. You can't apply the += operator to append a character array. I used strcat to add Fizz if i % 3 returns no remainder like you did there and set it to append (that is strcat" the string with "fizz". Same thing for buzz. Else, I simply overwrite the string with whatever is the value of i. However, it comes completely fucked up. Numbers output fine but for the terms that should come out as fizz, buzz, or fizzbuzz, they come out fucked up like "4buzzfizz"

#include
using namespace std;

int main() {
for(int tits = 1; tits

Check that else if statement.

Attached: lol no it isnt.png (653x858, 17K)

actually I caught that, but generally the ints that are divisible by both are accepted to just be the first, from every explanation I've seen. Here's what I did to change it. I could have also just removed the else I suppose
#include
using namespace std;

int main() {
for(int tits = 1; tits

wtf is with this nigger tier code? sage

> downsaging

Attached: image.jpg (396x382, 78K)

You're right. My apologies. If it really is your first, congratulations, as there are apparently many "programmers" who can't do this. There are multiple valid ways to solve the problem, and it's interesting to compare them.The one below cuts down on the number of evaluations needed, performing at most 3 per digit.
#include

int main(void) {

for (int i = 1; i < 101; i++){
if (!(i % 3)){
printf ("Fizz");
}
if (!(i % 5)){
printf ("Buzz");
}
else if ((i % 3))
{
printf("%d", i);
}
printf("\n");
}
return 0;
}

Attached: e8e18bb0-ab5d-46f3-8826-6526e3088b7b.png (334x874, 31K)

>fixed my app
>my app
>app

Attached: 1520562474852.png (800x600, 122K)

lmao if you have a "3 & 5" case and a "3" case and a "5" case. reduce that bro

Do FizzBuzz without modulo. Come on, Jow Forums.

If this isn't the level of Programming you are on you have ZERO chance.
My MATLAB fizzbuzz, you can understand this trivial code, right?

Attached: Capture.png (997x29, 4K)

>He uses loops
No, that is not the way to do this.

>You are mother will die in her sleep

>printf ("%d\n", i);
why is i a double now

%d or %i are for ints in C

what are local variables... let the compiler optimise them out.

Now write some C to find all the prime numbers between 1 and 1000

>Doesn't know about format specifiers

Attached: 1534185866831.png (1163x646, 942K)

>thinks 5|14