Category Archives: Program

WAP in C++ & Python for the Union of Two Arrays

Here in this program, we will code to combine two Array in a sorted manner. In this program, we will ask the user to enter elements for two arrays in ascending order and combine both arrays elements and store them in a new array. The new array which would be a union of user two… Read More »

Write a program in C++ and python to find the root of quadratic equation

Here in this program we will compute the 2 possible roots of a quadratic equation a quadratic equation is represented as ax2 + bx + c. a = coefficient of x2 b= coefficient of x c= constant C++: #include<iostream.h> #include< conio.h> #include<stdio.h> #include<math.h> void main() { clrscr(); float r_1,r_2,a,b,c,d,ip,rp; cout<<“Enter the coefficient of x^2; “;… Read More »

Write a program in C++ and python to swap two numbers without using a temporary variable:

In this program, we will accept two values from the user and then swap their variable name. C++: #include<iostream.h> #include< conio.h> #include<stdio.h> #include<math.h> void main() { clrscr(); int num_1,num_2; cout<<“Enter num_1: “; cin>>num_1; cout<<“Enter num_2: “; cin>>num_2; num_1= num_1+num_2; num_2= num_1-num_2; num_1= num_1-num_2; cout<<“After swapping\n”; cout<<“The value of num_1 is: “<<num_1<<“\n”; cout<<“The value of num_2… Read More »