Recent Posts

C Program for Drawing a Circle using Bresenham Circle Algorithm

#include<graphics.h> #include<conio.h> #include<stdio.h> void main() { int gd=DETECT,gm; int d,r,x,y,xc,yc; clrscr(); initgraph(&gd,&gm,"c:\\tc\\"); printf("Enter Radius\n"); scanf("%d",&r); printf("Enter Center of circle\n"); scanf("%d",&xc); scanf("%d",&yc); d=3-2*r; x=0; y=r; while(x<=y) { putpixel(xc+x,yc+y,5); putpixel(xc-y,yc-x,5); putpixel(xc+y,yc-x,5); putpixel(xc-y,yc+x,5); putpixel(xc+y,yc+x,5); putpixel(xc-x,yc-y,5); putpixel(xc+x,yc-y,5); putpixel(xc-x,yc+y,5); if(d<=0) { d=d+4*x+6; } else { d=d+4*x-4*y+10; y=y-1; } x=x+1; } getch(); } Output: Tags: C program for drawing a circle using Bresenhams circle algorithm, C ...

Read More »

Program for string in cross x format on given position

Program for string in x format on given contact position in the middle of your output screen  class formatx { public static void main(String s,int n) { int i,j,k,l=s.length(); char a[][]=new char[l*l][l*l]; j=l/2; for(i=0;i<15-j;i++) System.out.println(); for(i=0;i<l;i++)< span=""> a[i][l+i]=s.charAt(i); j=l+n; k=n-2; for(i=n-2;i>-1;i--) a[i][j++]=s.charAt(k--); j=l+n-2; k=n; for(i=n;i<l;i++)< span=""> a[i][j--]=s.charAt(k++); for(i=0;i<l;i++)< span=""> { for(j=0;j<65-l-n;j++) System.out.print(' '); for(j=0;j<l*3;j++)< span=""> { if(a[i][j]!=0) System.out.print(a[i][j]); else System.out.print(' ...

Read More »