Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

URI/BEE problem no-1101 solution in Java

import java.util.Scanner;
public class Main{
    public static void main (String[] args) {
        int M,N,i,j,sum = 0;
        Scanner obj = new Scanner(System.in);
        
        for(i = 1; i <= 3; i++){
            M = obj.nextInt();
            N = obj.nextInt();
            
            for(j = N,sum = 0; j <= M; j++){
                if(N <= 0){
                    System.exit(1);
                }else{
                    System.out.printf("%d ", j);
                    sum += j;
                }
                
            }
            System.out.println("Sum=" + sum);
        }
        
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java jpanel popup message 
Java :: method reference java 
Java :: how to make 2 nested loops to count to 100 
Java :: Use following code to open activity while your application is not running. 
Java :: how to check if a value is integer or not in java 
Java :: problemi arrayList javafx 
Java :: Java Remove EnumSet Elements 
Java :: java remove element from list 
Java :: Java 8 merge multiple collections using flatmap 
Java :: spring media part max size 
Java :: how to send images to storage using Admin Sdk in java 
Java :: JVM signatures 
Java :: java replace ignore case 
Java :: webmvctest vs springboottest 
Java :: focus button java swing 
Java :: your application is missing a valid safety identifier 
Java :: class java 
Java :: sorting boolean array with prime index 
Java :: open bottomsheet from adapter java 
Java :: also in java 
Java :: java how to make a recrussive boolean function 
Java :: generate paranthesis 
Java :: popcat 
Java :: Print positive numbers from array 
Java :: Java’s generic programming does not apply to the primitive types. True or False? 
Java :: java object array initialization 
Java :: swagger apiimplicitparam all endpoints 
Java :: if (copy = 5) { in java 
Java :: java focus to desktop 
Java :: java linkedlist 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =