Skip to main content

Posts

APC Book Class 11 Recursion Programs Solved

 Recursion Programs Solutions APC 1. int count(int n) {     if(n==0)         return 1;     return 1+count(n/10); } 2.  void dectobin(int n,int r){     if(n==0)     {         System.out.println("Binary is:"+r);     }     int d=n%2;     r=r*10+d;     dectobin(n/2,r); } 3.  int count(int n){     if(n==0)         return 0;     int d=n%2;     return ((d==1)?1:0)+count(n/2); } void check(int n){     if(count(n)==2)         System.out.println("Prime number");     else          System.out.println("Non-Prime number"); } 4. int fmin(int arr[],int n ) {     if(n==0)         return 999999;     return Math.min(arr[n-1],fmin(arr,n-1)); } 5. int fsum(int arr[],int n ) {     if(n==0)       ...
Recent posts

Python Turtle

  To draw a square ------------------- import turtle t=turtle.Turtle() for i in range(4):     t.forward(200)     t.right(90) To draw a circle ---------------- import turtle t=turtle.Turtle() for i in range(360):     t.forward(1)     t.right(1) To draw a rectangle -------------------- import turtle t=turtle.Turtle() for i in range(3):     t.forward(200)     t.right(90)     t.forward(80)     t.right(90)

2025 Results

 

2024 Results

 

2023 Results

 

Program to accept a number. Display the reverse of the number. Using Python

Program to accept a number. Display the reverse of the number. Input: 123 Output: 321 r=0 n = int(input("Enter a number:")) while n>0:     d=n%10     r=r*10+d     n=n//10 print("Reverse of the number is",r) ''' Dry Run r=0 n=123 123>0,True, d=123%10=3, r=0*10+3=3, n=123//10=12 12>0,True, d=12%10=2, r=3*10+2=32, n=12//10=1 1>0,True, d=1%10=1, r=32*10+1=321, n=1//10=0 0>0,False Reverse of the number is 321 '''

A departmental shop has 5 stores and 6 departments. The monthly sale of the department is kept in the Double Dimensional Array (DDA) as m[5][6]. The manager of the shop wants to know the total monthly sale of each store and each department at any time. Write a program to perform the given task. Hint: Number of stores as rows and Number of departments as columns.

 A departmental shop has 5 stores and 6 departments. The monthly sale of the department is kept in the Double Dimensional Array (DDA) as m[5][6]. The manager of the shop wants to know the total monthly sale of each store and each department at any time. Write a program to perform the given task. Hint: Number of stores as rows and Number of departments as columns. import java.util.Scanner; class Department{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int deptshop[][] = new int[5][6]; //5 stores(rows) 6 deparments(columns) int sales[] = new int[5]; //total sales data for 5 stores for(int i=0;i<5;i++){ //row System.out.println("Enter data for store:"+(i+1)); int sum=0; for(int j=0;j<6;j++){ //column System.out.println("Enter sales amount into department "+(j+1)); deptshop[i][j]=sc.nextInt(); sum=sum+deptshop[i][j]; } sales[i]=sum; //store the total sales amount for each store } ...