golclinics / DSA-Clinics24

9 stars 309 forks source link

Entry Challenge C2 #2

Open hum-dev opened 2 months ago

hum-dev commented 2 months ago

Entry Challenge C2

FizzBuzz

Write a program that prints the numbers from 1 to 100. For multiples of 3, print Fizz; for multiples of 5, print Buzz; and for numbers that are multiples of both 3 and 5, print FizzBuzz.

daviewisdm commented 3 weeks ago

for i in range(1, 101): if i % 3 == 0 and i % 5 == 0: print("FizzBuzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i)

Jeremiah-o commented 3 weeks ago

//javascriprt//

const final=[]; const num=1; while (count<=100){ if (num%3==0 && num%5==0){ final.push("FIZZBUZZ"); } else if(num%3==0){ final.push("FIZZ"); } else if (num%5==0){ final.push("BUZZ"); } else{ final.push(num); } num++; } console.log(final);

gateremark commented 3 weeks ago

STOP WRITING YOUR SOLUTIONS IN THE ISSUES KINDLY.

Create a Fork; Work on the challenge; Then create a PR (Pull Request) with your solution(s).

Thank you.

cc: @Jeremiah-o , @Angote433 , @daviewisdm

Simon-Njoroge commented 3 weeks ago

for (let i = 1; i <= 100; i++) { if (i % 3 === 0 && i % 5 === 0) { console.log("FizzBuzz"); } else if (i % 3 === 0) { console.log("Fizz"); } else if (i % 5 === 0) { console.log("Buzz"); } else { console.log(i); } }