Keep entering numbers till user enters a multiple of 10, simple Java programming Code by Naymul Islam PCIU CSE 18

 import java.util.Scanner;


public class KeepEnteringNumbersTillUserEntersMultipleOf {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        do {

            System.out.println("Enter your Number : ");

            int num = sc.nextInt();


            if (num % 10 == 0) {

                break;

            }

            System.out.println(num);

        } while (true);


    }

}

import java.util.Scanner;

public class KeepEnteringNumbersTillUserEntersMultipleOf {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        do {
            System.out.println("Enter your Number : ");
            int num = sc.nextInt();

            if (num % 10 == 0) {
                break;
            }
            System.out.println(num);
        } while (true);

    }
}

No comments:

Post a Comment

Max Sub Array Sum: Kadane's Algorithm

Code of: Max Sub Array Sum: Kadane's Algorithm. public class MaxSubArraySumKadanesALgorithm {     public static void Kadane ( int ...