after getting to know the language itself and giving myself an overall understanding of it, i started with my first task:
Let your program print out every number from 1-100. If the number is dividable by 3, the program has to print "Fizz" instead of the number. If it is dividable by 5, it has to print "Buzz". If both (dividable by 3 & 5) apply, it has to print "FizzBuzz".
(if i explain smth wrong or if you know easier ways to solve that task, please feel free to comment or text me! i'm more than open for help!)
Well that's how i did it:
first off i went and created an integer variable "num" with the value 100
i built a for loop starting from 0 on and told the program to keep going until it went up to 100 ("<=" means i want it to stop at exactly 100, "<" would end at 99)
inside of the for loop i put a few if statements in
the 1st if tests whether the current number is dividable by 3 and 5
here i put "if (i % 5 == 0 && i % 3 == 0)"... why?
-> "i" is the variable for the number that is "being tested" rn. We want to find out whether it is dividable by 5. For that we use "%".
This means, let's say i=2. How often does 2 fit into 5? 2 times. This results to 4 (2+2=4, another 2 won't fit into 5). now 5-4=1 soooo 2 % 5 == 1. 1 is the rest.
So , back to my code: to find out if "i" is dividable by 5, i%5 has to be equal to 0. If i%5 has any rest, it means that it is not dividable by 5. Same with 3 ofc.
The && here just means "and".
so.. long story short: IF "i" is dividable by 5 AND 3 print "FizzBuzz" (instead of "i") and go on to the next number. if it is not, go into the next if statement
the next "else if" statements say: if it is not dividable by 5 AND 3, is it dividable by 3/ 5 only? IF yes, print "Fizz"/ "Buzz" and keep going with the next number, else: go into else statement
the last else statement says: if you didnt apply to the first few if statements, just print "i"
.. well and that's about it:) programming this one was really fun and i enjoyed sound it so much ahhđЎđЎđ¤
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
â Live Streamingâ Interactive Chatâ Private Showsâ HD Quality
Anya is LIVE right now
FREE
Free to watch âĸ No registration required âĸ HD streaming
Hey there, future coding rock stars! Today, weâre diving into one of the simplest yet most powerful control structures in Java-the if statement. Imagine having the ability to make your code respond to different situations, just like deciding whether to carry an umbrella based on the weather. Thatâs exactly what the if statement does-it helps your program make decisions! Letâs explore how it worksâĻ
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
â Live Streamingâ Interactive Chatâ Private Showsâ HD Quality
Anya is LIVE right now
FREE
Free to watch âĸ No registration required âĸ HD streaming
In this article, Iâm going to give you a tutorial about utilizing multiple IF statements in Power BI. This short tutorial is from a specific thread in the Ent