Search Here

Showing posts with label C++. Show all posts
Showing posts with label C++. Show all posts

C program to draw Circle using Midpoint algorithm



/* C profram for Midpoint Circle Drawing */

#include<stdio.h>
#include<graphics.h>
int xc,yc;

void circlepoints(int x, int y)
{
    putpixel(xc+x,yc-y,BLACK);
    putpixel(xc-x,yc-y,BLACK);
    putpixel(xc+x,yc+y,BLACK);
    putpixel(xc-x,yc+y,BLACK);
    putpixel(xc+y,yc-x,BLACK);
    putpixel(xc-y,yc-x,BLACK);
    putpixel(xc+y,yc+x,BLACK);
    putpixel(xc-y,yc+x,BLACK);
}

int main()
{
    int gd = DETECT,gm;
    int r,x,y,d;
    
    printf("Enter the center of the circle:");
    scanf("%d %d",&xc,&yc);
    printf("Enter the radius of the circle:");
    scanf("%d",&r);
    
    x=0; y=r; d=1-r;
    //initgraph(&gd, &gm, "C:\\TC\\BGI"); /* For Windows Turbo-C users */
    initgraph(&gd,&gm,NULL); /* For Linux users */
    setbkcolor(WHITE);
    
    circlepoints(x,y);
    while(y>x)
    {
        x++;
        if(d<0)
            d=d+2*x+3;
        else
        {
            y--;
            d=d+2*x-2*y+5;
        }
        circlepoints(x,y);
    }
    delay(5000);
    closegraph();
   
    system("clear");
    return 0;
}


C program to draw a circle using Midpoint algorithm
Output

C program to draw Circle using Bresenham algorithm



/* C program for Bresenham Circle Drawing */

#include<stdio.h>
#include<graphics.h>

int xc,yc;

void circlepoints(int x, int y)
{
    putpixel(xc+x,yc-y,BLACK);
    putpixel(xc-x,yc-y,BLACK);
    putpixel(xc+x,yc+y,BLACK);
    putpixel(xc-x,yc+y,BLACK);
    putpixel(xc+y,yc-x,BLACK);
    putpixel(xc-y,yc-x,BLACK);
    putpixel(xc+y,yc+x,BLACK);
    putpixel(xc-y,yc+x,BLACK);
}

int main()
{
    int gd = DETECT,gm;
    int r,x,y,p;
    printf("Enter the center of the circle:");
    scanf("%d %d",&xc,&yc);
    printf("Enter the radius of the circle:");
    scanf("%d",&r);
    
    x=0; y=r;
    //initgraph(&gd, &gm, "C:\\TC\\BGI"); /* For Windows Turbo-C users */
    initgraph(&gd,&gm,NULL); /* For Linux users */
    setbkcolor(WHITE);
    
    circlepoints(x,y);
    p=3-2*r;
    while(y>x)
    {
        if(p<0)
            p=p+4*x+6;
        else
        {
            y=y-1;
            p=p+4*(x-y)+10;
        }
        x=x+1;
        circlepoints(x,y);
    }
    delay(5000);
    closegraph();
    
    system("clear");
    return 0;
}


C program to draw a circle using Bresenham algorithm
Output

C program to draw Line using Bresenham algorithm



/* C program for Bresenham Line Drawing */

#include<stdio.h>
#include<graphics.h>

int main()
{
    int gd = DETECT,gm;
    int x1,y1,x2,y2,k,dx,dy,p,x,y;
   
    printf("Enter the co-ordinates of 1st point:");
    scanf("%d %d",&x1,&y1);
    printf("Enter the co-ordinates of 2nd point:");
    scanf("%d %d",&x2,&y2);
   
    //initgraph(&gd, &gm, "C:\\TC\\BGI"); /* For Windows Turbo-C users */
    initgraph(&gd,&gm,NULL); /* For Linux users */
    setbkcolor(WHITE);

    dx=abs(x1-x2);
    dy=abs(y1-y2);
    p=2*dy-dx;
    x=x1;
    y=y1;
    
    putpixel(x1,y1,BLACK);
    for(k=1;k<=dx;k++)
    {
        if(p<0)
        {
            if(x<x2)
                x++;
            else
                x--;
            p=p+2*dy;
        }
        else
        {
            if(x<x2)
                x++;
            else
                x--;
            if(y<y2)
                y++;
            else
                y--;
            p=p+2*(dy-dx);
        }
        putpixel(x,y,BLACK);
     }
    delay(5000);
    closegraph();
    
    system("clear");
    return 0;
}


C program to draw a line using Bresenham algorithm
Output

C program to draw Line using DDA algorithm



/* C program for DDA Line drawing */

#include<graphics.h>
#include<stdio.h>
#include<math.h>
#define ROUND(a) ((int)(a+0.5))

int main()
{
    int x1,y1,x2,y2,dx,dy,steps,gd,gm;
    float x_inc,y_inc,x,y;
    
    printf("Enter the co-ordinates of 1st point:");
    scanf("%d %d",&x1,&y1);
    printf("Enter the co-ordinates of 2nd point:");
    scanf("%d %d",&x2,&y2);
    
    dx=abs(x1-x2);
    dy=abs(y1-y2);
    if(dx>dy)
        steps=dx;
    else
        steps=dy;
        
    x_inc = (float)dx/steps;
    y_inc = (float)dy/steps;
    detectgraph(&gd,&gm);
   
    //initgraph(&gd, &gm, "C:\\TC\\BGI"); /* For Windows Turbo-C users */
    initgraph(&gd,&gm,NULL); /* For Linux users */
    setbkcolor(WHITE);
    
    putpixel(x1,y1,BLACK);
    while(steps>=1)
    {
        x += x_inc;
        y += y_inc;
        putpixel(ROUND(x),ROUND(y),BLACK);
        steps--;
    }
    delay(5000);
   
    closegraph();
    return 0;
}



C program to draw a line using DDA algorithm
Output

C program to draw Lower Case Alphabets



/* C program to draw a - z */

#include<graphics.h>
int main()
{
    int gd = DETECT,gm;
   
    //initgraph(&gd, &gm, "C:\\TC\\BGI"); /* For Windows Turbo-C users */
    initgraph(&gd,&gm,NULL); /* For Linux users */
    setbkcolor(WHITE);
    setcolor(BLACK);
    
    /* Block to draw a */
    ellipse(265,95,180,375,80,50);
    ellipse(267,230,30,320,80,60);
    ellipse(350,190,90,250,20,90);
    delay(5000); cleardevice();
    
    /* Block to draw b */
    line(200,70,200,370);
    ellipse(200,295,270,90,90,75);
    delay(10000); cleardevice();
    
    /* Block to draw c */
    ellipse(320,240,90,270,90,100);
    circle(320,148,8);
    delay(10000); cleardevice();
    
    /* Block to draw d */
    line(200,70,200,370);
    ellipse(200,295,90,270,90,75);
    delay(10000); cleardevice();
    
    /* Block to draw e */
    ellipse(320,240,180,0,90,100);
    line(230,240,410,240);
    ellipse(320,240,40,270,90,100);
    delay(10000); cleardevice();
    
    /* Block to draw f */
    arc(270,100,180,20,70);
    line(200,100,200,350);
    line(180,120,220,120);
    delay(10000); cleardevice();
    
    /* Block to draw g */
    line(200,70,200,350);
    ellipse(200,145,90,270,90,75);
    arc(150,350,0,180,50);
    line(100,350,200,220);
    delay(10000); cleardevice();
    
    /* Block to draw h */
    line(200,70,200,350);
    arc(260,250,180,0,60);
    line(320,250,320,350);
    delay(10000); cleardevice();
    
    /* Block to draw i */
    circle(320,80,10);
    line(320,100,320,320);
    delay(10000); cleardevice();
    
    /* Block to draw j */
    circle(320,80,10);
    line(320,100,320,320);
    arc(290,320,0,180,30);
    delay(10000); cleardevice();
    
    /* Block to draw k */
    line(200,30,200,380);
    line(200,235,340,90);
    line(200,235,340,380);
    delay(10000); cleardevice();
    
    /* Block to draw l */
    line(200,70,200,350);
    delay(10000); cleardevice();
    
    /* Block to draw m */
    arc(180,150,200,20,20);
    line(200,150,200,280);
    arc(250,150,180,0,50);
    line(300,150,300,280);
    arc(350,150,180,0,50);
    line(400,150,400,280);
    delay(10000); cleardevice();
    
    /* Block to draw n */
    arc(180,150,200,20,20);
    line(200,150,200,280);
    arc(250,150,180,0,50);
    line(300,150,300,280);
    delay(10000); cleardevice();
    
    /* Block to draw o */
    circle(200,200,100);
    delay(10000); cleardevice();
    
    /* Block to draw p */
    line(200,70,200,370);
    ellipse(200,145,270,90,90,75);
    delay(10000); cleardevice();
    
    /* Block to draw q */
    line(200,70,200,370);
    ellipse(200,145,90,270,90,75);
    delay(10000); cleardevice();
    
    /* Block to draw r */
    line(200,120,200,280);
    arc(250,155,180,0,50);
    circle(295,155,5);
    delay(10000); cleardevice();
    
    /* Block to draw s */
    ellipse(200,145,90,270,90,75);
    ellipse(200,295,270,90,90,75);
    delay(10000); cleardevice();
    
    /* Block to draw t */
    line(290,70,290,350);
    line(230,120,350,120);
    line(290,350,350,300);
    delay(10000); cleardevice();
    
    /* Block to draw u */
    ellipse(320,100,360,180,100,250);
    delay(10000); cleardevice();
    
    /* Block to draw v */
    line(200,70,290,380);
    line(380,70,290,380);
    delay(10000); cleardevice();
    
    /* Block to draw w */
    line(140,110,200,330);
    line(270,160,200,330);
    line(270,160,330,330);
    line(390,110,330,330);
    delay(10000); cleardevice();
    
    /* Block to draw x */
    line(200,70,380,380);
    line(380,70,200,380);
    delay(10000); cleardevice();
    
    /* Block to draw y */
    line(170,100,285,230);
    line(400,100,180,350);
    delay(10000); cleardevice();
    
    /* Block to draw z */
    line(200,70,380,70);
    line(200,380,380,380);
    line(260,220,330,220);
    line(380,70,200,380);
    delay(1000); cleardevice();
    
    closegraph();
    system("clear");
    return 0;
}


C program to draw all Lower Case Alphabets
Output
C program to draw all Lower Case Alphabets
Output

C program to draw Upper Case Alphabets



/* C program to draw Alphabets Upper Case */

#include<stdio.h>
#include<graphics.h>

void A() //For A
{   
    int x1=300;
    int y1=100;
    int x2=150;
    int y2=400;
    int x3=300;
    int y3=100;
    int x4=450;
    int y4=400;
    int x5=225;
    int y5=250;
    int x6=375;
    int y6=250;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    delay(2000);
    cleardevice();  
}

void B()//For B
{   
    int x1=370;
    int y1=50;
    int x2=300;
    int y2=50;
    int x3=300;
    int y3=50;
    int x4=300;
    int y4=200;
    int x5=300;
    int y5=200;
    int x6=370;
    int y6=200;
    int x7=370;
    int y7=200;
    int x8=400;
    int y8=180;
    int x9=400;
    int y9=180;
    int x10=400;
    int y10=150;
    int x11=400;
    int y11=150;
    int x12=350;
    int y12=125;
    int x13=350;
    int y13=125;
    int x14=400;
    int y14=100;
    int x15=400;
    int y15=100;
    int x16=400;
    int y16=70;
    int x17=400;
    int y17=70;
    int x18=370;
    int y18=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    line(x9,y9,x10,y10);
    line(x11,y11,x12,y12);
    line(x13,y13,x14,y14);
    line(x15,y15,x16,y16);
    line(x17,y17,x18,y18);
    delay(2000);
    cleardevice();
}

void C()//For C
{   
    int x1=380;
    int y1=100;
    int x2=400;
    int y2=100;
    int x3=400;
    int y3=100;
    int x4=400;
    int y4=50;
    int x5=400;
    int y5=50;
    int x6=300;
    int y6=50;
    int x7=300;
    int y7=50;
    int x8=300;
    int y8=200;
    int x9=300;
    int y9=200;
    int x10=400;
    int y10=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    line(x9,y9,x10,y10);
    delay(2000);
    cleardevice();
}

void D()//For D
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=200;
    int x4=360;
    int y4=200;
    int x5=360;
    int y5=200;
    int x6=400;
    int y6=180;
    int x7=400;
    int y7=180;
    int x8=400;
    int y8=80;
    int x9=400;
    int y9=80;
    int x10=360;
    int y10=50;
    int x11=360;
    int y11=50;
    int x12=300;
    int y12=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    line(x9,y9,x10,y10);
    line(x11,y11,x12,y12);
    delay(2000);
    cleardevice();
}

void E()//For E
{   
    int x1=300;
    int y1=200;
    int x2=300;
    int y2=50;
    int x3=300;
    int y3=200;
    int x4=400;
    int y4=200;
    int x5=300;
    int y5=125;
    int x6=350;
    int y6=125;
    int x7=300;
    int y7=50;
    int x8=400;
    int y8=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    delay(2000);
    cleardevice();
}

void F()//For F
{   
    int x1=300;
    int y1=200;
    int x2=300;
    int y2=50;
    int x3=300;
    int y3=50;
    int x4=400;
    int y4=50;
    int x5=300;
    int y5=125;
    int x6=350;
    int y6=125;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    delay(2000);
    cleardevice();
}

void G()//For G
{   
    int x1=400;
    int y1=50;
    int x2=300;
    int y2=50;
    int x3=300;
    int y3=50;
    int x4=300;
    int y4=200;
    int x5=300;
    int y5=200;
    int x6=350;
    int y6=200;
    int x7=350;
    int y7=200;
    int x8=350;
    int y8=125;
    int x9=350;
    int y9=125;
    int x10=400;
    int y10=125;
    int x11=400;
    int y11=125;
    int x12=400;
    int y12=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    line(x9,y9,x10,y10);
    line(x11,y11,x12,y12);
    delay(2000);
    cleardevice();
}

void H()//For H
{   
    int x1=300;
    int y1=200;
    int x2=300;
    int y2=50;
    int x3=400;
    int y3=200;
    int x4=400;
    int y4=50;
    int x5=300;
    int y5=125;
    int x6=400;
    int y6=125;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    delay(2000);
    cleardevice();
}

void I()//For I
{   
    int x1=300;
    int y1=200;
    int x2=400;
    int y2=200;
    int x3=300;
    int y3=50;
    int x4=400;
    int y4=50;
    int x5=350;
    int y5=200;
    int x6=350;
    int y6=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    delay(2000);
    cleardevice();
}

void J()//For J
{   
    int x1=300;
    int y1=50;
    int x2=400;
    int y2=50;
    int x3=400;
    int y3=50;
    int x4=400;
    int y4=200;
    int x5=400;
    int y5=200;
    int x6=300;
    int y6=200;
    int x7=300;
    int y7=200;
    int x8=300;
    int y8=170;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    delay(2000);
    cleardevice();
}

void K()//For K
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=125;
    int x4=400;
    int y4=50;
    int x5=300;
    int y5=125;
    int x6=400;
    int y6=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    delay(2000);
    cleardevice();
}

void L()//For L
{   
    int x1=300;
    int y1=200;
    int x2=300;
    int y2=50;
    int x3=300;
    int y3=200;
    int x4=400;
    int y4=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    delay(2000);
    cleardevice();
}

void M()//For M
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=50;
    int x4=400;
    int y4=100;
    int x5=400;
    int y5=100;
    int x6=500;
    int y6=50;
    int x7=500;
    int y7=50;
    int x8=500;
    int y8=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    delay(2000);
    cleardevice();
}

void N()//For N
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=50;
    int x4=400;
    int y4=200;
    int x5=400;
    int y5=200;
    int x6=400;
    int y6=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    delay(2000);
    cleardevice();
}

void O()//For O
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=200;
    int x4=400;
    int y4=200;
    int x5=400;
    int y5=200;
    int x6=400;
    int y6=50;
    int x7=400;
    int y7=50;
    int x8=300;
    int y8=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    delay(2000);
    cleardevice();
}

void P()//For P
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=50;
    int x4=400;
    int y4=50;
    int x5=400;
    int y5=50;
    int x6=400;
    int y6=125;
    int x7=400;
    int y7=125;
    int x8=300;
    int y8=125;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    delay(2000);
    cleardevice();
}

void Q()//For Q
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=200;
    int x4=400;
    int y4=200;
    int x5=400;
    int y5=200;
    int x6=400;
    int y6=50;
    int x7=400;
    int y7=50;
    int x8=300;
    int y8=50;
    int x9=380;
    int y9=180;
    int x10=430;
    int y10=230;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    line(x9,y9,x10,y10);
    delay(2000);
    cleardevice();
}

void R()//For R
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=50;
    int x4=400;
    int y4=50;
    int x5=400;
    int y5=50;
    int x6=400;
    int y6=125;
    int x7=400;
    int y7=125;
    int x8=330;
    int y8=125;
    int x9=330;
    int y9=125;
    int x10=400;
    int y10=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    line(x9,y9,x10,y10);
    delay(2000);
    cleardevice();
}

void S()//For S
{   
    int x1=400;
    int y1=50;
    int x2=300;
    int y2=50;
    int x3=300;
    int y3=50;
    int x4=300;
    int y4=125;
    int x5=300;
    int y5=125;
    int x6=400;
    int y6=125;
    int x7=400;
    int y7=125;
    int x8=400;
    int y8=200;
    int x9=400;
    int y9=200;
    int x10=300;
    int y10=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    line(x9,y9,x10,y10);
    delay(2000);
    cleardevice();
}

void T()//For T
{   
    int x1=300;
    int y1=50;
    int x2=450;
    int y2=50;
    int x3=375;
    int y3=50;
    int x4=375;
    int y4=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    delay(2000);
    cleardevice();
}

void U()//For U
{   
    int x1=300;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=200;
    int x4=400;
    int y4=200;
    int x5=400;
    int y5=200;
    int x6=400;
    int y6=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    delay(2000);
    cleardevice();
}

void V()//For V
{   
    int x1=300;
    int y1=50;
    int x2=350;
    int y2=200;
    int x3=350;
    int y3=200;
    int x4=400;
    int y4=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    delay(2000);
    cleardevice();
}

void W()//For W
{   
    int x1=300;
    int y1=50;
    int x2=350;
    int y2=200;
    int x3=350;
    int y3=200;
    int x4=450;
    int y4=125;
    int x5=450;
    int y5=125;
    int x6=550;
    int y6=200;
    int x7=550;
    int y7=200;
    int x8=600;
    int y8=50;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    line(x7,y7,x8,y8);
    delay(2000);
    cleardevice();
}

void X()//For X
{   
    int x1=300;
    int y1=50;
    int x2=400;
    int y2=200;
    int x3=400;
    int y3=50;
    int x4=300;
    int y4=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    delay(2000);
    cleardevice();
}

void Y()//For Y
{   
    int x1=400;
    int y1=50;
    int x2=300;
    int y2=200;
    int x3=300;
    int y3=50;
    int x4=350;
    int y4=125;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    delay(2000);
    cleardevice();
}

void Z()//For Z
{   
    int x1=300;
    int y1=50;
    int x2=400;
    int y2=50;
    int x3=400;
    int y3=50;
    int x4=300;
    int y4=200;
    int x5=300;
    int y5=200;
    int x6=400;
    int y6=200;
   
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    line(x5,y5,x6,y6);
    delay(2000);
    cleardevice();
}

int main()
{   
    int gd=DETECT,gm;
    initgraph(&gd,&gm,"c:\\turboc3\\bgi"); /* Windows Turbo-C users */
    //initgraph(&gd,&gm,NULL); /* LINUX users */
    
    A();
    B();
    C();
    D();
    E();
    F();
    G();
    H();
    I();
    J();
    K();
    L();
    M();
    N();
    O();
    P();
    Q();
    R();
    S();
    T();
    U();
    V();
    W();
    X();
    Y();
    Z();
   
    closegraph();
    return 0;
}



B

C program to draw Upper Case Alphabets (7-Segment style)


/* C program to draw A - Z */

#include<graphics.h>
int main()
{
    int gd = DETECT,gm;
 
    //initgraph(&gd, &gm, "C:\\TC\\BGI"); /* For Windows Turbo-C users */
    initgraph(&gd,&gm,NULL); /* For Linux users */
    setbkcolor(WHITE); setcolor(BLACK);
    
    /* Block to draw A */
    line(312,117,162,441);
    line(312,117,438,441);
    line(225,306,384,306);
    delay(10000); cleardevice();
    
    /* Block to draw B */
    line(200,70,200,370);
    ellipse(200,145,270,90,90,75);
    ellipse(200,295,270,90,90,75);
    delay(10000); cleardevice();
    
    /* Block to draw C */
    ellipse(320,240,90,270,90,140);
    delay(10000); cleardevice();
    
    /* Block to draw D */
    line(200,70,200,370);
    ellipse(200,220,270,90,120,150);
    delay(10000); cleardevice();
    
    /* Block to draw E */
    line(200,70,200,380);
    line(200,70,380,70);
    line(200,220,350,220);
    line(200,380,380,380);
    delay(10000); cleardevice();
    
    /* Block to draw F */
    line(200,70,200,380);
    line(200,70,380,70);
    line(200,220,350,220);
    delay(10000); cleardevice();
    
    /* Block to draw G */
    ellipse(320,240,90,270,90,140);
    line(320,240,320,380);
    line(320,240,380,240);
    line(380,240,380,380);
    delay(10000); cleardevice();
    
    /* Block to draw H */
    line(200,70,200,380);
    line(380,70,380,380);
    line(200,220,380,220);
    delay(10000); cleardevice();
    
    /* Block to draw I */
    line(200,70,200,380);
    line(195,70,205,70);
    line(195,380,205,380);
    delay(10000); cleardevice();
    
    /* Block to draw J */
    line(200,70,200,380);
    line(195,70,205,70);
    ellipse(150,380,0,180,50,30);
    delay(10000); cleardevice();
    
    /* Block to draw K */
    line(200,70,200,380);
    line(200,225,380,70);
    line(200,225,380,380);
    delay(10000); cleardevice();
    
    /* Block to draw L */
    line(200,70,200,380);
    line(200,380,380,380);
    delay(10000); cleardevice();
    
    /* Block to draw M */
    line(200,70,200,380);
    line(200,70,300,220);
    line(300,220,400,70);
    line(400,70,400,380);
    delay(10000); cleardevice();
    
    /* Block to draw N */
    line(200,70,200,380);
    line(380,70,380,380);
    line(200,70,380,380);
    delay(10000); cleardevice();
    
    /* Block to draw O */
    ellipse(320,240,0,360,190,200);
    delay(10000); cleardevice();
    
    /* Block to draw P */
    line(200,70,200,370);
    ellipse(200,145,270,90,90,75);
    delay(10000); cleardevice();
    
    /* Block to draw Q */
    ellipse(320,240,0,360,180,190);
    line(400,380,450,460);
    delay(10000); cleardevice();
    
    /* Block to draw R */
    line(200,70,200,370);
    ellipse(200,145,270,90,90,75);
    line(200,220,330,370);
    delay(10000); cleardevice();
    
    /* Block to draw S */
    ellipse(200,145,90,270,90,75);
    ellipse(200,295,270,90,90,75);
    delay(10000); cleardevice();
    
    /* Block to draw T */
    line(290,70,290,380);
    line(200,70,380,70);
    delay(10000); cleardevice();
    
    /* Block to draw U */
    ellipse(320,100,360,180,100,250);
    delay(10000); cleardevice();
    
    /* Block to draw V */
    line(200,70,290,380);
    line(380,70,290,380);
    delay(10000); cleardevice();
    
    /* Block to draw W */
    line(140,110,200,330);
    line(270,160,200,330);
    line(270,160,330,330);
    line(390,110,330,330);
    delay(10000); cleardevice();
    
    /* Block to draw X */
    line(200,70,380,380);
    line(380,70,200,380);
    delay(10000); cleardevice();
    
    /* Block to draw Y */
    line(170,100,285,230);
    line(400,100,285,230);
    line(285,230,285,400);
    delay(10000); cleardevice();
    
    /* Block to draw Z */
    line(200,70,380,70);
    line(200,380,380,380);
    line(380,70,200,380);
    delay(10000); cleardevice();
    
    closegraph();
    system("clear");
    return 0;
}


C program to draw all Upper Case Alphabets
Output

C program to draw all Upper Case Alphabets
Output