# Author Archives: Singh

## 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 calculate 3X3 Matrix multiplication:

In this program, we will code for the matrix multiplication. A matrix is a 2-D array which means a list inside a list. To multiply two matrices, their dimension should be the same and it should be a square matrix. A matrix is known as a square matrix when its number of rows is equal… 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 »

## Write a program in C++ and python to check whether the number is even or odd

In this program, we will code to check whether the entered number is an even or odd. An even number is that number which is divisible by 2 and an odd number is that number which is not divisible by 2. C++: #include<iostream.h> #include< conio.h> #include<stdio.h> #include<math.h> void main() { clrscr(); int num; cout<<“Enter a… Read More »

## Write a program in C++ and python to convert temperature from Fahrenheit to Celsius and vice-versa

In this program first, we will ask the user whether he wants to change the temperature from Fahrenheit to Celsius or vice versa and then accept a temperature and convert it. C++: #include<iostream.h> #include< conio.h> #include<stdio.h> #include<math.h> void main() { clrscr(); float ut,ct; int ch; cout<<“Enter 1 to change temperature from Fahrenheit to Celsius\n”; cout<<“Enter… Read More »

## Write a program in C++ and python to check whether a given character is an alphabet, digit or any special character

Here in this program, we will determine whether the type of the entered input. C++: #include<iostream.h> #include< conio.h> #include<stdio.h> #include<math.h> void main() { clrscr(); char ch; cout<<“Enter a character: ” ; cin>>ch; if((ch>=’A ‘&& ch<=’Z’)||(ch>=’a’ && ch<=’z’)) cout<<“It is an alphabet”; else { if (ch>=’0’&&ch<=’9′) cout<<“It is a digit”; else cout<<“It is a special character”;… Read More »

## Write a program in C++ and python to check whether the year is a leap year or not

In the program we will ask the user to enter a year and display whether the year is a leap year or not, there are some conditions to be a leap year. C++: #include<iostream.h> #include<conio.h> #include<stdio.h> #include<math.h> void main() { clrscr(); int y; cout<<“Enter any year: “; cin>>y; if (y%4==0){       if(y%100==0)         {if(y%400==0)            … Read More »

## Binary Search in C

Binary search is a searching algorithm, used to tell the position of a value that is stored in an array. It is called a binary search because in order to search the value it divides the array into 2 parts.

## C Data Types

C is one of the famous programming languages among programmer community because it is a building block of many high-level programming languages. With a diminishing future, C is about to become a part of programming history, yet beginners suggested to start their programming journey with C because its data type and structure helps to understand… Read More »

## Write a C++ Program to perform arithmetic operations using switch case

In this program, we will use the C++ switch case to perform for arithmetic operations such as Addition, Subtraction, Multiplication and Division C++ program to perform arithmetic operations using switch case #include<iostream.h> #include<conio.h> void main() { clrscr(); float num_1,num_2; int operation; cout<<“What Arithmetic Operation You want to perform:\n”; cout<<“Press 1 for Addition \n” ; cout<<“Press… Read More »