#include< stdio.h> #include< graphics.h> #include< conio.h> void BRESENHAM_CIRCLE(int x,int y,int r); void circlePlot(int,int,int,int); void main() { int x,y,r,gdriver=DETECT,gmode; clrscr(); initgraph(&gdriver,&gmode,""); printf("\nEnter point(x,y):"); scanf("%d %d",&x,&y); printf("\nEnter radius:"); scanf("%d",&r); BRESENHAM_CIRCLE(x,y,r); getch(); } void BRESENHAM_CIRCLE(int xCen,int yCen,int r) { int x=0; int y=r; int s=3-2*r; circlePlot(xCen,yCen,x,y); while(x < y) { x++; if(s < 0) s+=4*x+6; else { y--; s+=4*(x-y)+10; } circlePlot(xCen,yCen,x,y); } } void circlePlot(int xCen,int yCen,int x,int y) { putpixel(xCen+x,yCen+y,WHITE); putpixel(xCen-x,yCen+y,WHITE); putpixel(xCen+x,yCen-y,WHITE); putpixel(xCen-x,yCen-y,WHITE); putpixel(xCen+y,yCen+x,WHITE); putpixel(xCen-y,yCen+x,WHITE); putpixel(xCen+y,yCen-x,WHITE); putpixel(xCen-y,yCen-x,WHITE); }
#include #include void main() { int i,os_m,nPage,total,pg[25]; clrscr(); printf("\nEnter total memory size:"); scanf("%d",&total); printf("\nEnter memory for OS:"); scanf("%d",&os_m); printf("\nEnter no. of pages:"); scanf("%d",&nPage); for(i=0;i =pg[i]) { printf("\n Allocate page %d",i+1); total=total-pg[i]; } else printf("\n page %d is not allocated due to insufficient memory.",i+1); } printf("\n External Fragmentation is:%d",total); getch(); } OUTPUT Enter total memory size:1024 Enter memory for OS:256 Enter no. of pages:4 Enter size of page[1]:128 Enter size of page[2]:512 Enter size of page[3]:64 Enter size of page[4]:512 Allocate page 1 Allocate page 2 Allocate page 3 page 4 is not allocated due to insufficient memory. External Fragmentation is:64
UmetcusVatshi Juan Reyes https://wakelet.com/wake/MFQz6LvQINy9ERSmyVJst
ReplyDeletesoundzeppomur
guignosgramku Scott Jones Autodesk Maya
ReplyDeleteThe Bat!
Tor browser
warenzasi