C program to open a website url

c graphics program

C program to open a website url This program will launch Mozilla Firefox web browser to open a website so it should be installed on your computer, if you are using an another web browser then you can change path in the program.   #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <graphics.h> #include <dos.h> #include … Read more

C program to draw a 3D bar chart

3d bar chart program in c

C program to draw a 3D bar chart #include <graphics.h> #include <conio.h> int main() { int gd = DETECT, gm; initgraph(&gd, &gm, “C:\\TC\\BGI”); setcolor(YELLOW); rectangle(0,30,639,450); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); setcolor(WHITE); outtextxy(275,0,”Bar Chart”); setlinestyle(SOLID_LINE,0,2); line(100,420,100,60); line(100,420,600,420); line(90,70,100,60); line(110,70,100,60); line(590,410,600,420); line(590,430,600,420); outtextxy(95,35,”Y”); outtextxy(610,405,”X”); outtextxy(85,415,”O”); setfillstyle(LINE_FILL,BLUE); bar(150,100,200,419); setfillstyle(XHATCH_FILL,RED); bar(225,150,275,419); setfillstyle(WIDE_DOT_FILL,GREEN); bar(300,200,350,419); setfillstyle(INTERLEAVE_FILL,MAGENTA); bar(375,125,425,419); setfillstyle(HATCH_FILL,BROWN); bar(450,175,500,419); getch(); return 0; }  

Bar chart program in c

bar chart program in c

Bar chart program in c Chart is drawn using bars filled with different styles and in different colors. #include <graphics.h> #include <conio.h> main() { int gd = DETECT, gm; initgraph(&gd, &gm, “C:\\TC\\BGI”); setcolor(YELLOW); rectangle(0,30,639,450); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); setcolor(WHITE); outtextxy(275,0,”Bar Chart”); setlinestyle(SOLID_LINE,0,2); line(100,420,100,60); line(100,420,600,420); line(90,70,100,60); line(110,70,100,60); line(590,410,600,420); line(590,430,600,420); outtextxy(95,35,”Y”); outtextxy(610,405,”X”); outtextxy(85,415,”O”); setfillstyle(LINE_FILL,BLUE); bar(150,100,200,419); setfillstyle(XHATCH_FILL,RED); bar(225,150,275,419); setfillstyle(WIDE_DOT_FILL,GREEN); bar(300,200,350,419); setfillstyle(INTERLEAVE_FILL,MAGENTA); … Read more

Paint program in c language

painting program in language

Paint program in c language   This program can draw different shapes using mouse such as line, circle, pixel and many other shapes. You can also change the color, clear the screen. #include<graphics.h> #include<dos.h> #include<math.h> #include<stdlib.h> #include<stdio.h> #include<conio.h> union REGS i, o; int leftcolor[15]; int get_key() { union REGS i,o; i.h.ah = 0; int86(22, &i, … Read more

Drawing concentric circles – C graphics examples

c graphics program example

Drawing concentric circles – C graphics examples   #include <graphics.h> int main() { int gd = DETECT, gm; int x = 320, y = 240, radius; initgraph(&gd, &gm, “C:\\TC\\BGI”); for ( radius = 25; radius <= 125 ; radius = radius + 20) circle(x, y, radius); getch(); closegraph(); return 0; }    

C graphics programming

basic graphics program in c

C graphics programming     #include <graphics.h>   #include <conio.h>    int main()   {       int gd = DETECT, gm;      initgraph(&gd, &gm,”C:\\TC\\BGI”);      outtextxy(10, 20, “Graphics programming is fun!”);      circle(200, 200, 50);       setcolor(BLUE);       line(350, 250, 450, 50);       getch();       closegraph( );       return 0;   }

comment in c program

comment in c program

comment in c program   Example – comments in a program #include <stdio.h>   int main()   {      // Single line comment in a C program      printf(“Writing comments is very useful.\n”);      /*       * Multi-line comment syntax       * Comments help us to understand program later … Read more

C Program to Check Whether a Character is Vowel or Consonant

c program for vowel and consonent

C Program to Check Whether a Character is Vowel or Consonant The five alphabets A, E, I, O and U are called vowels. All other alphabets except these 5 vowel letters are called consonants.   #include <stdio.h> int main() { char c; int isLowercaseVowel, isUppercaseVowel; printf(“Enter an alphabet: “); scanf(“%c”,&c); // evaluates to 1 (true) … Read more

C Program to Find Factorial of a Number

factorial program example in c

C Program to Find Factorial of a Number The factorial of a positive number n is given by: factorial of n (n!) = 1*2*3*4….n The factorial of a negative number doesn’t exist. And, the factorial of 0 is 1, 0! = 1 #include <stdio.h> int main() { int n, i; unsigned long long factorial = 1; … 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