traffic light program in c

traffic program in c

Traffic light program in c #include<graphics.h> #include<conio.h> #include<dos.h> #include<stdlib.h> main() { int gd = DETECT, gm, midx, midy; initgraph(&gd, &gm, “C:\\TC\\BGI”); midx = getmaxx()/2; midy = getmaxy()/2; setcolor(RED); settextstyle(SCRIPT_FONT, HORIZ_DIR, 3); settextjustify(CENTER_TEXT, CENTER_TEXT); outtextxy(midx, midy-10, “Traffic Light Simulation”); outtextxy(midx, midy+10, “Press any key to start”); getch(); cleardevice(); setcolor(WHITE); settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); rectangle(midx-30,midy-80,midx+30,midy+80); circle(midx, midy-50, 22); … Read more

C Program to check whether a Number is a Palindrome

palindrome program in c

C Program to check whether a Number is a Palindrome A palindrome is a number or a string which is similar when read from the front and from the rear. For example: 121 or Oppo etc. Below is a program to check whether a number is a palindrome or not. #include<stdio.h> #include<conio.h> void main() { int a, … Read more

C Program to find LCM of two Numbers using Recursion

LCM program example in c

C Program to find LCM of two Numbers using Recursion What is LCM LCM: Least Common Multiple of two numbers is the number that is a common multiple of the both the numbers. Below is a program to find LCM of two numbers using recursion. #include<stdio.h> int find_lcm(int, int); // function prototype declaration int main() { … Read more

Tetris Game in C : Game program in C

tetris game in c

Tetris Game in C : Game program in C Let us see the Tetris Game in C #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <dos.h> #include <conio.h> void swap(int a,int b);void bar1();void bar2(); void bar3(); void bar4(); check0(); check1(); check2(); void del(); void rod1(); void rod2(); void box1();void box2();void tee1();voidtee2(); void tee3();void tee4();check3();void insert(); void … Read more