Graphics Program in C++ for Analog Clock

C Programming Tutorial

Analog Clock is mini project  in a C ++ language. It is graphics application using graphic library <graphics.h>. This program is Compiled using Turbo C++. Here is the source code of this program in C++ using Graphics.   /*Program for analog CLock*/ #include <stdio.h> #include <conio.h> #include <math.h> #include <string.h> #include <graphics.h> #include <time.h> #include <dos.h> void minSecPos(int xrad, int midx, … Read more

C program to find armstrong number

C Programming Tutorial

What is Armstrong number? Sum of a number’s digits raised to the power total number of digits is armstrong number. Armstrong numbers example: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634 etc Explanation: 3 = 3^1 = 3 153 = 1^3 + 5^3 + 3^3 = 153 Non-Armstrong … Read more

Simple Calculator program in C

C Programming Tutorial

This is a simple calculator program written in C Language. It Performs addition, subtraction, multiplication or division depending the input from user. This usage switch case statement. Let see the C Program # include <stdio.h> int main() { char operator; double firstNumber,secondNumber; printf(“Enter an operator (+, -, *,): “); scanf(“%c”, &operator); printf(“Enter two operands: “); … Read more

tic-tac-toe game in c

C Programming Tutorial

This is a tic-tac-toe game in C Language.  You can this as a mini project in C Language.     #include<stdio.h> #include<conio.h> #include<stdlib.h> #include <windows.h> int board[10] = {2,2,2,2,2,2,2,2,2,2}; int turn = 1,flag = 0; int player,comp; void menu(); void go(int n); void start_game(); void check_draw(); void draw_board(); void player_first(); void put_X_O(char ch,int pos); COORD … Read more

Analog Clock Program in C

C Programming Tutorial

Here is simple C program for analog clock.  This can be used as a reference for project reference. /*Note press ctrl+pause break to stop the clock while executing in TC*/ #include<stdio.h> #include<graphics.h> #include<stdlib.h> #include<math.h> #include<dos.h> #include<time.h> #define PI 3.147 void clockLayout(); void secHand(); void hrHand(); void minHand(); int maxx,maxy; void main() { int gdriver=DETECT,gmode,error; initgraph(&gdriver,&gmode,“c:\turboc3\bgi\”); … Read more

C Program to Check Leap Year

C Programming Tutorial

   A year is a leap year if − It is evenly divisible by 100 If it is divisible by 100, then it should also be divisible by 400 Except this, all other years evenly divisible by 4 are leap years. —————————————————————— #include <stdio.h> int main() { int year; printf(“Enter a year: “); scanf(“%d”,&year); if(year%4 … Read more

C program for Snake game

C Programming Tutorial

Snake Game is mini project  in a C language. It is console application without graphic library that’s why it is more interesting. This game is perfect without any error and better user interface. It is complied in code block using c language. Here goes a source code you can copy and compiled it in code block. … Read more

C Program to find prime number

C Programming Tutorial

What is prime number? Definition of prime number A number is considered as prime number when it satisfies the below conditions.It should be whole number It should be greater than 1 It should have only 2 factors. They are, 1 and the number itself. For Example: 2, 3, 5, 7, 11, 13, 17, 19, 23, … Read more

The do-while Loop in C

the do while loop in c

There is a minor difference between the working of while and do while loops. This difference is the place where the condition is tested. The while tests the condition before executing any of the statements within the while loop. As against this, the do-while tests the condition after having executed the statements within the loop. … Read more