first commit

This commit is contained in:
Jose Caban
2025-06-07 11:38:03 -04:00
commit e0316ca3ff
79 changed files with 3155 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
class fizzbuzz
{
private static void fizzBuzz(int n)
{
for (int i = 1; i <= n; i++)
{
if (i%3 == 0 || i%5 == 0)
{
if (i%3 == 0)
System.out.print("fizz");
if (i%5 == 0)
System.out.print("buzz");
}
else
{
System.out.print(i);
}
System.out.println("");
}
}
// Your program begins with a call to main().
// Prints "Hello, World" to the terminal window.
public static void main(String args[])
{
System.out.print("How many fizzbuzzes?: ");
String input = System.console().readLine();
try
{
int n = Integer.parseInt(input);
fizzBuzz(n);
}
catch (Exception e)
{
System.out.println("Invalid input");
return;
}
}
}