online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Sample Input: 77 output: Additionpersist :2 mulitiply persist :4 explain: 7+7=14 | 1+4=5 =>2 7*7=49 | 4*9=36 | 3*6=18 |1*8=8 =>4 Total it takes 4 iteration to convert to single digit ,ll'ly for addition its 2 *******************************************************************************/ import java.util.Scanner; public class Main { public static int add_mul_Persist(int a,int c){ int temp=(c==0)?1:0; while(a>0){ int y = a%10; if(c==0){ temp*=y; } else{ temp+=y; } a=a/10; } return temp; } public static int Persist(int a,int c){ int count =0; // int res =add_mul_Persist(a,c); // System.out.println(res); while(a>9){ count++; int x=add_mul_Persist(a,c); a=x; System.out.println(a); } return count; } public static void main(String[] args) { Scanner scan =new Scanner(System.in); int a =scan.nextInt(); int c=0; if(a<9){ System.out.println("Number should greater than 9"); } else{ int mul_result=Persist(a,c); c=1; int add_result=Persist(a,c); System.out.println("Addition Persist: "+ add_result); System.out.println("Multiplication Persist: " + mul_result); }} }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue