#Help help help!!!
1 messages · Page 1 of 1 (latest)
Store them both as variables then combine them.
if you let me know the language i can provide further assistance. i typically work in asm and c but i have experience in over 50 languages.
heres a simple implementation in java as i see that is your role:
import java.util.Scanner;
public class SumExample {
public static int addTwoNumbers(int num1, int num2) {
return num1 + num2;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the first number: ");
int number1 = scanner.nextInt();
System.out.print("Enter the second number: ");
int number2 = scanner.nextInt();
int sum = addTwoNumbers(number1, number2);
System.out.println("The sum of " + number1 + " and " + number2 + " is: " + sum);
scanner.close();
}
}
of course you can do the same thing with string concat.
import java.util.Scanner;
public class StringConcatExample {
public static String concatenateStrings(String str1, String str2) {
return str1 + str2;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the first string: ");
String string1 = scanner.nextLine();
System.out.print("Enter the second string: ");
String string2 = scanner.nextLine();
String result = concatenateStrings(string1, string2);
System.out.println("The concatenated string is: " + result);
scanner.close();
}
}
Thank you so much!