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

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 switch case program to read weekday number and print weekday name

C Programming Tutorial

C switch case program to read weekday number and print weekday name This program will read weekday number (0-6) and print weekday name (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday)   Weekday Number Weekday Name 0 Sunday 1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday Program Example: #include <stdio.h> int main() … 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

if else statement in c

C Programming Tutorial

The if statement by itself will execute a single statement, or a group of statements, when the expression following if evaluates to true. It does nothing when the expression evaluates to false. Can we execute one group of statements if the expression evaluates to true and another group of statements if the expression evaluates to … 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

C program to Check VOWEL or CONSONANT

C Programming Tutorial

C program to Check VOWEL or CONSONANT This program is written in c language. This is a example of switch case. This will read a character from user as input and check whether it is VOWEL or CONSONANT. #include <stdio.h> int main() { char ch; printf(“Enter a character: “); scanf(“%c”,&ch); //condition to check character is … Read more

C program to print digital clock

C Programming Tutorial

C program to print digital clock This program is written in C Language using graphics. This will show day, month, date, current time and year as output.   Logic for the digital clock program Initialize hour, minute, seconds with 0. Run an infinite loop. Increase second and check if it is equal to 60 then increase … Read more

graphics program for traffic light in C++

C Programming Tutorial

Here is traffic light program written in C++ using graphics.h header file. This program is Compiled using Turbo C++. /*Program for traffic Light*/ #include<iostream.h> #include<graphics.h> #include<conio.h> #include<dos.h> #include<stdlib.h> void main() { clrscr(); int gd = DETECT, gm, midx, midy; initgraph(&gd, &gm, “C:\\TC\\BGI”); midx = getmaxx()/2; midy = getmaxy()/2; setcolor(CYAN); settextstyle(TRIPLEX_FONT, HORIZ_DIR, 4); settextjustify(CENTER_TEXT, CENTER_TEXT); outtextxy(midx, midy-10, “Traffic Light … Read more