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

C program to draw circles in circles

C program to draw circles in circles

C program to draw circles in circles #include<graphics.h> #include<conio.h> #include<dos.h> main() { int gd = DETECT, gm, x, y, color, angle = 0; struct arccoordstype a, b; initgraph(&gd, &gm, “C:\\TC\\BGI”); delay(2000); while(angle<=360) { setcolor(BLACK); arc(getmaxx()/2,getmaxy()/2,angle,angle+2,100); setcolor(RED); getarccoords(&a); circle(a.xstart,a.ystart,25); setcolor(BLACK); arc(getmaxx()/2,getmaxy()/2,angle,angle+2,150); getarccoords(&a); setcolor(GREEN); circle(a.xstart,a.ystart,25); angle = angle+5; delay(50); } getch(); closegraph(); return 0; }  

C Program to print half pyramid using alphabets

C Programming Tutorial

C Program to print half pyramid using alphabets A B B C C C D D D D E E E E E Let’s see the program code #include <stdio.h> int main() { int i, j; char input, alphabet = ‘A’; printf(“Enter the uppercase character you want to print in last row: “); scanf(“%c”,&input); for(i=1; … Read more

Hello Word – First C program

C Programming Tutorial

Hello Word – First C program #include <stdio.h> int main() { // printf() displays the string inside quotation printf(“Hello, World!”); return 0; } Lets understand “Hello, World!” program The #include <stdio.h> is a pre processor command. This command tells compiler to include the contents of stdio.h (standard input and output) file in the program. The stdio.h file contains functions such as scanf() and print() to take … 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

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

C Program to Check Even or Odd number

turbo c++ program editor

C Program to Check Even or Odd number : C Program Example An even number is an integer that is exactly divisible by 2. Example: 2,4,6, 8,10,12,14,16 etc An odd number is an integer that is not exactly divisible by 2. Example: 1, 3,5,7, 9,11, 15,17 etc C Program start from here #include int main() … Read more

Switch Case Control Structure in C

C Programming Tutorial

In real life we are often faced with situations where we are required to make a choice between a number of alternatives rather than only one or two. For example, what subject to choose after 10th, which school or college to join or which place to visit. We almost always end up making a wrong … Read more