SHARE
TWEET

Untitled

a guest Feb 24th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package ex5_;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author bil
  13.  */
  14. public class Ex5_ {
  15.  
  16.     /**
  17.      * @param args the command line arguments
  18.      */
  19.     public static void main(String[] args) {
  20.         // TODO code application logic here
  21.         Scanner sc = new Scanner(System.in);
  22.        
  23.         int a=sc.nextInt() , b=sc.nextInt(), j,num;
  24.        
  25.         j=a;
  26.  
  27.          while(j>Integer.MIN_VALUE){
  28.              j--;
  29.              for(num=0;num<a+1;num++){
  30.                    
  31.                  if((j+num)==a){
  32.                      
  33.                      if((j-num)==b){
  34.                           System.out.printf("j(%d) + num(%d) = %d \n",j,num,j+num);
  35.                              System.out.printf("j(%d) - num(%d) = %d \n",j,num,j-num);
  36.                      }
  37.                              
  38.                  }
  39.                  
  40.              }                          
  41.              
  42.          }
  43.      
  44.        
  45.     }
  46.    
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top