C++ program for linear search
Programs

C++ program for the linear search

In this example, you will learn the C++ program for the linear search algorithm. This program finds the position of the target value by comparing it with each element of an array. if there are six elements in an array i.e 5, 7, 2, 1,3, and 9. The user asks to find 1. The program … Read more

Programs

C++ program for binary search

In this example, you will learn a C++ program for the binary search algorithm. This program finds the position of the target value within the sorted array list.  How does Binary search work? In binary search, elements are searched from the middle of an array. It is applicable only on sorted arrays even in ascending … Read more

Programs

C++ program to count positive, negative, and zeros

In this example, we will learn a C++ program to count positive, negative, and zeros in an array. This program takes the maximum number for an array from the user and counts similar numbers. Example: C++ program to count positive negative and zeros Here is the code to take maximum array values from the user. … Read more

Programs

C++ program to find HCF and LCM

In this example, you will learn a c++ program to find LCM and HCF. LCM means the least common multiple. If we have two numbers 6 and 10, The LCM of these numbers will be 30. It means that 6 and 10 are the least common multiple of 30. While on the other hand HCF … Read more

Programs

C++ program to find the largest of two numbers

In this example, you will learn a c++ program to find the largest value between two numbers. This program takes to numbers from the user and displays the largest value. If the user enters 4 and 7 program finds the largest from both which is 7. Program: Find Largest of Two Numbers in C++ Output … Read more

Programs

C++ program to print Floyd’s triangle

In this example, you will learn a C++ program to print Floyd’s triangle.  Floyd’s triangle is a right-angle triangle of natural numbers whose all sides are equal. This program takes maximum rows from the user and prints Floyd’s triangle on the console screen. Example: Floyd’s triangle in C++ Output Description and working on this program … Read more

Programs

C++ program to print Pascal’s triangle

In this example, you will learn a C++ program to print Pascal’s triangle on the screen.  Pascal’s triangle is formed by placing 1 along the right and left edges. After that, each value of the triangle is filled by the sum of the above row’s two values just above the given position. This triangle was … Read more

Programs

C++ program to reverse numbers

In this example, we will learn a C++ program to reverse numbers. This program takes one number from the user and programs reverses it. Like a number 235 after reverse become 532. Example: C++ program to reverse numbers Here is the code to take a number from the user. Programs reverse it and display it … Read more

Scroll to Top