Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mathtraning;
- import java.util.Scanner;
- /**
- *
- * @author Roy
- */
- public class Mathtraning {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.println("Enter a function: mx + n");
- String function = in.next();
- char x = 'x';
- String d = "";
- for(int i=0;i<function.length();i++){
- if(function.charAt(i)==x){
- char num = function.charAt(i-1);
- d = d + num;
- }
- System.out.println(d);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement