Selection Sort Algorithm

sorting algorithm

Selection Sort Algorithm Selection sort is an algorithm that selects the smallest element from an unsorted list in each iteration and places that element at the beginning of the unsorted list. The Selection sort algorithm is based on the idea of finding the minimum or maximum element in an unsorted array and then putting it … Read more

Quick Sort Algorithm

sorting algorithm

Quick Sort Algorithm There are may versions of Quick sort, which is one of the most popular sorting methods due to its speed (O(N lgN) average, but O(N^2) worst case). Here’s the steps to follow: Pick a “pivot” item Partition the other items by adding them to a “less than pivot” sublist, or “greater than … Read more

C Program to Check whether an Alphabet is Vowel or Consonant

c program to check vowel and consonant

C Program to Check whether an Alphabet is Vowel or Consonant This program takes the character value(entered by user) as input and checks whether that character is a vowel or consonant using if-else statement. Since a user is allowed to enter an alphabet in lowercase and uppercase, the program checks for both uppercase and lowercase … Read more

Merry Christmas – Program for Christmas Tree in C

merry christmas program in c

Merry Christmas – Program for Christmas Tree in C   To print a Christmas tree, we are printing pyramids of various sizes just one beneath the other. For the decoration, a random character is printed at each position. Height and randomness can be adjusted. This is been repeated frame after frame to give the illusion of a true event. … Read more

C Program to Add two numbers

c program to add 2 numbers

C Program to Add two numbers Program to add two integer numbers To read the input numbers we are using scanf() function and then we are using printf() function to display the sum of these numbers. The %d used in scanf() and printf() functions is the format specifier which is used for int data types in C programming. … Read more

C program to print happy holi

c program to sort array

C program to print happy holi Here is the simple program written in c to Print Happy Holi.   #include<stdio.h> #include<conio.h> void main() { printf(“HAPPY HOLI “); getch(); }    

Pascal trangle program in c

Pascal trangle program in c Pascal Triangle is a Triangle form which, each number is the sum of immediate top row near by numbers. The Value of edge is always 1. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 Let’s Start C program:   #include <stdio.h> int main() … Read more

Linear search program in c

c program to sort array

Linear search program in c   #include <stdio.h> int main() { int array[100], search, c, n; printf(“Enter number of elements in array\n”); scanf(“%d”, &n); printf(“Enter %d integer(s)\n”, n); for (c = 0; c < n; c++) scanf(“%d”, &array[c]); printf(“Enter a number to search\n”); scanf(“%d”, &search); for (c = 0; c < n; c++) { if … Read more

Sorting program in c

c program to sort array

Sorting program in c /* * C program to accept N numbers and arrange them in an ascending order */ #include <stdio.h> void main() { int i, j, a, n, number[30]; printf(“Enter the value of N \n”); scanf(“%d”, &n); printf(“Enter the numbers \n”); for (i = 0; i < n; ++i) scanf(“%d”, &number[i]); for (i … Read more

Write a program to convert temperature Fahrenheit to Centigrade

temperature Fahrenheit to Centigrade degrees c program

Write a program to convert temperature Fahrenheit to Centigrade Input temperature in fahrenheit from user. Store it in some variable say fahrenheit. Apply the temperature conversion formula celsius = (fahrenheit – 32) * 5 / 9. Print the value of celsius. Example Input Temperature in fahrenheit = 205 Output Temperature in celsius = 96.11 C Temperature conversion formula … Read more