Archive for the ‘C‘ Category

Linear Search: C

In this video tutorial we shall see how we can search for a number in an array in linear fashion. First ask the user to enter the number to be searched. Store it inside a variable called key. Now start comparing key value with a[i] using a for loop. If the key is found in [...]

Find First and Second Biggest In An Array, Without Sorting It: C

We assume that a[0] has first biggest and a[1] has the second biggest value. Now check if this assumption is correct, if not, swap the values.   if( sbig > fbig ) { temp = sbig; sbig = fbig; fbig = temp; } Now since we have already checked with a[0] and a[1], we start [...]

Find Biggest In An Array, Without Sorting It: C

First we have to assume that a[0] is biggest. Now store the value of a[0] inside a variable called big. Now compare value of big with other values in the array. If big is less than any other value, then store the bigger value inside variable big. Video Tutorial: Biggest In An Array, Without Sorting [...]

Bubble Sort: C

In this video tutorial we illustrate the bubble sort algorithm and also see how to write it in C programming, for 5 elements as well as to N elements. In bubble sort, a[0] is compared with a[1]. a[1] with a[2], a[2] with a[3] .. so on if a[0] is greater than a[1], the values are [...]

Selection Sort of N numbers: C

Selection sort is a sorting technique which is inefficient on large list of elements. Its simple and easy to understand. In selection sort, first we select one element and compare it with the rest of the elements. If the compared element is smaller than the selected element, then those numbers are sorted. This approach is [...]

Find the Factorial of a Number: C

This video tutorial illustrates finding factorial of a given number using C programming. In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. Ex: if user enters 5, then the factorial is 1 * 2 * 3 * 4 * [...]

Find Sum of Digits In A Given Number: C

Video Tutorial to illustrate, C Program to find sum of digits in the given/user entered integer number. In this program we assign variable sum = 0 to avoid garbage values in sum before the calculation, which would result in wrong output. We store the user entered value in num. 1 2 3 4 5 6 [...]

Find Given Number Is Prime or Not: C

A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. A natural number greater than 1 that is not a prime number is called a composite number. For example, 7 is prime, as only 1 and 7 divide it, whereas 10 is [...]

Colorful Text Output: C program

This video tutorial shows a simple method to get the output in different colors, on the dosprompt: using a simple C program. Video Tutorial: Colorful Text Output: C program YouTube Link: http://www.youtube.com/watch?v=TpasN_6RMMM [Watch the Video In Full Screen.] Full Source code: Colorful Text Output: C program C 1 2 3 4 5 6 7 8 [...]

Write Data To Text File In C: Character by Character

This video tutorial demonstrates the creation of a simple file and writing data to text file ‘character by character’ using a simple C program. #include< stdio.h> is the only header file required to include. DOSBOX I’m using a software called DOSBOX to write my c program. Using this software we can run 32-bit programs on [...]

Simple Interest: C Program

Video Tutorial illustrating: C Program To Calculation of Simple Interest. Header File: #include<stdio.h> To be able to use printf function, we have to include stdio.h header file. main() This is the starting point of C program execution. since it does not return any value, we write void main() Declaration of Variables: int p, n; float [...]