02.11.2014, 08:07
I program in java so here is solution -
didnt tested it caz currently i dont have bluej on my pc
But should work...
Код:
package question2; import java.util.Scanner; public class Question2 { void main() { Scanner input = new Scanner(System.in); System.out.println("Enter an integer between 1000 and 9999: "); int num = input.nextInt(); System.out.println("Enter a digit (between 0 and 9): "); int d = input.nextInt(); System.out.println("Enter a character: "); char ch = input.nextLine.charAt(0);//thats how u enter a char String result = (ch-1);//it stores the final result int r,c = 1,f=num; while(num != 0) { r = num % 10; num = num/10; if(c==2 || c==4)result+=d; else result+=r; c++; } result+= (ch+1); System.out.println("Number was "+f+". Result : "+result); } }
But should work...