online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import java.io.*; import java.util.Scanner; public class Main { static int count=0; public static int[] tutors(int a) { int l; if(a%4==0) { l=a/4; count+=1; } else { l=(a/4)+1; } int b[]=new int[l]; for(int c=0;c<l;c++) { if(a>4) { b[c]=4; a-=4; } else if(a<4 && a!=0) { b[c]=a; } } return b; } static void display(int[][] num) { System.out.println(); for(int x = 0; x < num.length; x++) { for(int y = 0; y < num[x].length; y++) { System.out.print(num[x][y] + " "); } System.out.println(); } } public static void main(String args[]) { int c1,c2,c3,c4; Scanner x=new Scanner(System.in); System.out.println("Enter no. of slow learners in batch1"); c1=x.nextInt(); System.out.println("Enter no. of slow learners in batch2"); c2=x.nextInt(); System.out.println("Enter no. of slow learners in batch3"); c3=x.nextInt(); System.out.println("Enter no. of slow learners in batch4"); c4=x.nextInt(); int ta[][]=new int[4][]; ta[0]=tutors(c1); ta[1]=tutors(c2); ta[2]=tutors(c3); ta[3]=tutors(c4); display(ta); System.out.println("No batches in which all tutors have exactly 4 students :"+count); } } /* 2. Write a program to demonstrate the knowledge of students in multidimensional arrays and looping constructs. Eg., If there are 4 batches in BTech(IT) learning ‘ITE2005’ course, read the count of the slow learners (who have scored <25) in each batch. Tutors should be assigned in the ratio of 1:4 (For every 4 slow learners, there should be one tutor). Determine the number of tutors for each batch. Create a 2-D jagged array with 4 rows to store the count of slow learners in the 4 batches. The number of columns in each row should be equal to the number of groups formed for that particular batch ( Eg., If there are 23 slow learners in a batch, then there should be 6 tutors and in the jagged array, the corresponding row should store 4, 4, 4, 4, 4,3). Use for-each loop to traverse the array and print the details. Also print the number of batches in which all tutors have exactly 4 students. */

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