an algorithm to check prime number

algorithm

An algorithm to check prime number A number that is divisible only by itself and 1, is prime number Example of prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23…. etc Algorithm Step 1: Start Step 2: Declare variables n,i,flag. Step 3: Initialize variables flag←1 i←2 Step 4: Read n from user. Step … Read more

Bubble Sort Algorithm

algorithm

Bubble Sort : Overview Bubble sort is considered the simplest sorting algorithm. Bubble Sort is used to sort a given set of n elements provided in form of an array with n number of elements. Bubble Sort compares all the element one by one and sort them based on their values. It is known as … Read more

an algorithm for making a cup of tea

algorithm

What is algorithm An algorithm is step by step description of the method to solve a problem. It is an effective procedure for solving a problem in a finite number of steps an algorithm to find the factorial of a number How to start writing algorithm : Step by Step solve the problem Problem Description … Read more

an algorithm to find the factorial of a number

What is algorithm An algorithm is step by step description of the method to solve a problem. It is an effective procedure for solving a problem in a finite number of steps an algorithm to find the factorial of a number How to start writing algorithm : Step by Step solve the problem Problem Description … Read more

An algorithm to find the largest among three different numbers

algorithm

How to start writing algorithm : Step by Step solve the problem Problem Description – Find description of the problem. Problem Analysis – Analyze the problem. Start writing steps to resolve the problem in your language. Re-analyze the steps and try to add more details. Final Review   An algorithm to find the largest among three … Read more

Basic of Algorithm : Start Writing Algorithm

algorithm

Basic of Algorithm : Start Writing Algorithm Algorithm are the set of well defined instruction in sequence to solve a problem. This is a instruction written in English language,  step by step to solve the problem An algorithm should always have a clear stopping point. Inputs and outputs should be defined precisely. Each steps in … Read more

Linear search program in c

Linear search program in c What is linear search or sequential search : Definition of linear search As the name linear search or sequential search, search the number one by one in the specified array or list. linear search or sequential search is a method for finding a target value within a list. It sequentially … Read more

binary search program in C

binary search program in C Overview: C Program for binary search This is a program of binary search in C language. It can only be used for sorted arrays, but it’s fast as compared to linear search. If you wish to use binary search on an array which isn’t sorted, then you must sort it … Read more

Write a C program to calculate the distance between two cities

C Programming Tutorial

Problem Statement: The distance between two cities (in km.) is input through the keyboard. Write a C program to convert and print this distance in meters, feet, inches and centimeters. Answer: /* Conversion of distance */ #include <stdio.h> #include <conio.h> main() { float km, m, cm, ft, inch; clrscr(); /* To clear the screen */ … Read more

C program to find number of days in a month

C Programming Tutorial

C program to find number of days in a month This is a simple program to get number of days in a month. Leap year is not being chacked in the program. This program uses switch case. #include <stdio.h> int main() { int month; int days; printf(“Enter month: “); scanf(“%d”,&month); switch(month) { case 4: case … Read more