Computer Science, asked by kanakchamola, 1 year ago

question no. 3...

plzzzzzzzz fast....

Attachments:

Answers

Answered by mebijay
3

import java.util.Scanner;



public class Main {



   public static void main(String[] args) {


       int m = 0, n = 0;



       Scanner sc = new Scanner(System.in);



       System.out.print("Please Eneter a value for m : ");


       m = sc.nextInt();



       System.out.print("Please Eneter a value for n : ");


       n = sc.nextInt();



       if(m < n){


           int sum = 0;



           for(int i = m+1; i<n; i++)


               sum+=i;



           System.out.println("The sum of numbers between m and n is = " + sum);


       }else{


           System.out.println("The value of m can't be less than n");


       }


   }


}


kanakchamola: java...
mebijay: I've updated the answer. The program is tested and works perfectly :)
hiramani7080: mebijay could you open my profile and solve some of my questions?
kanakchamola: thank u very much.....
mebijay: hiramani7080 sorry I don't code in python
Similar questions