Simple programs

Program to compute the word length of the host machine

Here is the program to compute the word length of the host machine. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #include "stdio.h" #include "conio.h" void main() { int a,x; clrscr(); x=sizeof(a); printf("%d\n",sizeof(a)); if(x==2) { printf("Word length of host machine is 16 bits"); } else […]


To find the biggest and smallest number and positions in the given array

This program deals with finding the largest and smallest magnitude in an array.  The program asks the user to enter the dimension of the integer array, which he can enter soon after that. Logic: The entered array is traced through the dimension. Initially the program assumes the first member is the smallest and the greatest […]


to find the gross and net salary

Here is a simple  program which finds the Gross and Net pay of an employ when the user enters his basic salary. Logic : Here we divided the the employee into three categories according to his basic pay. The first category is getting the basic pay less than Rs.5000/-. Second category is having the basic […]


to find the roots of a quadratic equation

Every Quadratic equation has two roots. And this program is implemented to find the roots of the entered quadratic equation. Logic : The roots of any quadratic equation of the the form, are, The same equation is computerized here. The program asks user to enter the three coefficients a, b and c. Then it finds […]


To calculate area and circumference of the circle

Let us start from the beginning. Here discusses a model program for calculating the circumference and the area of the circle, where the radius is specified by the user. Logic: As we know, Circumference is ‘Pi’ times diameter of the circle and Area is ‘Pi’ times the radius squared. Implementing the same is the main […]


to find the biggest and smallest of three numbers

Here is an optimized program to find the largest and smallest among three entered numbers. Logic : The entered three numbers N1, N2, N3 are compared in such an order, where the first comparison checks if  N1  largest. If so, prints it out and exists; if not so, it omits N1 from further comparison and […]


To calculate area and circumference of the circle

Let us start from the beginning. Here discusses a model program for calculating the circumference and the area of the circle, where the radius is specified by the user. Logic: As we know, Circumference is ‘Pi’ times diameter of the circle and Area is ‘Pi’ times the radius squared. Implementing the same is the main […]