You are viewing a single comment's thread. Return to all comments →
JAVA 8:
public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s=sc.next(); int k=sc.nextInt(); String ne=""; for(int i=0;i<s.length();i++) { if((s.charAt(i))+k>9) ne+=(Integer.toString(((s.charAt(i))-48+k)%10)); else ne+=(Integer.toString(((s.charAt(i))-48+k))); } System.out.println(ne); }
Seems like cookies are disabled on this browser, please enable them to open this website
Security Key Spaces
You are viewing a single comment's thread. Return to all comments →
JAVA 8: