Google Add

Search

Find Smallest Number of an Array - C, C++ Code

C, C++ Program to Print Smallest Element of an Array
C, C++ Program to Print Smallest Element of an Array
Write a C, C++ program to find smallest number of an array. Given an unsorted array, we have to write a code to print smallest number or element of an array.

To understand this problem,  Let's take an array arr[] = {3, 4, 1, 5, 6}. The smallest number in an array is 1.

Now the question is how to solve this problem. You can use multiple approaches to solve this problem.

C Program to Find Largest of Three Numbers using Ternary Operator

Write a C program to find largest of three numbers using ternary operator. Given three input numbers, we have to write a code to find largest of three numbers using ternary operator.

Program to Print Hello World without using Semicolon - C, C++ Code

Write a C, C++ program to print hello world without using semicolon. In this tutorial, we are going to write a program which will print hello world using if-else, while and switch statements.

In c, c++ programming language every line ends with a semicolon, so it seems tricky how do you use printf  in C and cout in C++ without semicolon.

Java Program to Count Number of Digits in a Number

Write a Java program to count number of digits in a number. In this program, We take a number as an input and print the count of digit in a number.

Java Program to Count Number of Digits in a Number




Binary Search Program Using Recursion in C, C++

Write a C, C++ code to implement binary search program using recursion.

 What is Binary Search? 

Binary Search algorithm is used to search an element in a sorted array. Binary search works by comparing the value to the middle element of an array. If the value is found then index is returned otherwise the steps is repeated until the value is found.

It is faster than linear search.

Time complexity of Linear search is O(n).

Time complexity of Binary search is O(log(n)).