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
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.☺️
_____________________________________________
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❤️
Similar questions