utkarsh-shekhar / basic-programs

7 stars 53 forks source link

Added Fizzbuzz program using java #62

Closed kallepallimounikasmitha closed 4 years ago

kallepallimounikasmitha commented 7 years ago

ohkay! I will take a look in the issues!

Thanks!

With Regards, Mounika Smitha, Amrita University. https://www.amrita.edu/ Blog https://mounika894.wordpress.com/ | Github https://github.com/kallepallimounikasmitha| linkedin https://www.linkedin.com/in/mounika-smitha-kallepalli-09413913a/

On 17 October 2017 at 10:58, Utkarsh Shekhar notifications@github.com wrote:

@utkarsh-shekhar requested changes on this pull request.

Someone has already created a fizz-buzz.java example. Can you please create any other basic program in java and raise a PR for that? I'll be happy to merge it! :)

In java/Fizzbuzz.java https://github.com/utkarsh-shekhar/basic-programs/pull/62#discussion_r145030299 :

@@ -0,0 +1,23 @@ +import java.util.*; +public class Fizzbuzz{

  • public static void main(String[] args){
  • System.out.println("Enter the number:");
  • int n=100;
  • for(int i=1;i<=n;i++){
  • if(i%5 == 0){

Wrong logic. For 15, it will print Buzz as the first condition will satisfy and other else if conditions won't be reached. You should have the last else if with the check for 3 and 5 to be the very first check.

In java/Fizzbuzz.java https://github.com/utkarsh-shekhar/basic-programs/pull/62#discussion_r145030357 :

@@ -0,0 +1,23 @@ +import java.util.*; +public class Fizzbuzz{

  • public static void main(String[] args){
  • System.out.println("Enter the number:");

No need to have this message as you are not reading user input.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/utkarsh-shekhar/basic-programs/pull/62#pullrequestreview-69768538, or mute the thread https://github.com/notifications/unsubscribe-auth/AULESzMFLEggVooVktXn2CIo84WiGvqxks5stDsTgaJpZM4P61df .

utkarsh-shekhar commented 4 years ago

Closing this as this is an old PR. Please raise a new PR if needed.