Computer Science, asked by abirami133, 1 year ago

write a program to input two numbers and add the first number with the last digit of the second number in bluej

Answers

Answered by prathamesh1855
3
⛤Hey There⛤
_____________________________________________


Write a program to input two numbers and add the first number with the last digit of the second number in bluej
_____________________________________________


import java.io.*;

 

public class Practice{

public static void main(String[] args) {

try{

BufferedReader br=new BufferedReader(newInputStreamReader(System.in));

 

  System.out.println("Enter the Numbers");

  int n=Integer.parseInt(br.readLine());

 

  int last=n%10;

  int first=0;

  while(n>=1){

  first=n;

  n=n/10;

  }

 

System.out.println("sum of first and last digits: "+(first+last));

}

 

catch(IOException e){

System.out.println("error");

}

 

}

}
_____________________________________________

Hope This Helps.☺️

abirami133: Hey thank youu❤️
prathamesh1855: My Pleasure
prathamesh1855: How Old Are You?
prathamesh1855: Mark Me As Brainliest
Similar questions