Inheritance is a fundamental concept in object-oriented programming that allows one class to inherit properties and behaviors from another class. In our previous article, we discussed classes in Java, which…
study trigger
-
-
Welcome to the second part of our series on data science. In the previous article, we discussed the basics of data science, including its definition, history, and benefits. If you…
-
In today’s data-driven world, organizations and individuals are constantly generating and collecting large amounts of data. This data can be used to gain valuable insights, drive decision-making, and create new…
-
Java is an object-oriented programming language that allows developers to create complex and sophisticated applications by using a variety of programming constructs. One such construct is the abstract class, which…
-
C++ ProgramsProgramsRecursive Function
Program to print even or odd numbers in a given range using recursion.
by Mahesh Vermaby Mahesh VermaProgram to print even or odd numbers in a given range using recursion in C++. Solution: #include <iostream> using namespace std; void calculate(int start, int n) { if(start> n) return;…
-
C++ ProgramsProgramsRecursive Function
Program to find Factorial of a number using recursion
by Mahesh Vermaby Mahesh VermaProgram to find Factorial of a number using recursion in C++ Solution #include <iostream> using namespace std; int factorial(int n) { if(n==1) return 1; else return n*factorial(n-1); } int main()…
-
C++ ProgramsProgramsRecursive Function
Write a program to calculate reverse of a number using recursion.
by Mahesh Vermaby Mahesh VermaProgram to calculate reverse of a number in C++. Solution: #include <iostream> using namespace std; int rev(int n) { static int r=0; if(n==0) return r; else { r=(r*10)+n%10; return rev(n/10);…
-
C++ ProgramsProgramsRecursive Function
Program to find the sum of digits of a number using recursion.
by Mahesh Vermaby Mahesh VermaProgram to find the sum of digits of a number using recursion in C++. Solution #include <iostream> using namespace std; int sumdigit(int n) { if (n == 0) return 0;…
-
C++ ProgramsProgramsRecursive Function
Program to count the digits of a given number using recursion
by Mahesh Vermaby Mahesh VermaProgram to count the digits of a given number using recursion in C++. Solution : #include <iostream> using namespace std; int CountD(int n) { static int count=0; if (n >…
-
C++ ProgramsProgramsRecursive Function
Program to calculate the sum of numbers from 1 to n using recursion
by Mahesh Vermaby Mahesh VermaProgram to calculate the sum of numbers from 1 to n using recursion in C++. Solution #include <iostream> using namespace std; int sum(int n) { if (n != 0) return…