Skip to main content

Posts

Showing posts from March, 2020

Corona virus guidelines chart program in C language

C Program to create Amazing  Coronavirus guidelines Chart #include<graphics.h> #include<dos.h> #include<conio.h> void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"C:\\Turboc3\\BGI"); int x,y,i; x=getmaxx()/2; y=getmaxy()/2; setbkcolor(0); for(i=0;i<20;i++){ //-------- rectangle ----------------- setcolor(i+2); rectangle(20,20,x*2-15,y*2-150); delay(600); rectangle(15,15,x*2-10,y*2-145); delay(400); //----------- heading ------------ setcolor(i+1); settextstyle(7,HORIZ_DIR,2); outtextxy(x-170,45, "-: CORONA VIRUS GUIDELINES :-"); line(x-180,73,x+200,73); delay(500); // ---------- points section ------------ setcolor(i); settextstyle(1,HORIZ_DIR,1); outtextxy(35,90,"1. STAY HOME. "); outtextxy(35,120,"2. REGULARLY WASH YOUR HANDS. "); outtextxy(35,150,"3. MAINTAIN SOCIAL DISTANCE AND AVOID PUBLIC GATHERING . "); outtextxy(35,180,"4. AVOID TOUCHING EYES,NOSE AND M...

Toss game program in C language

CODE FOR TOSS GAME  #include<stdio.h> #include<time.h> #include<stdlib.h>  // its a standard library header file main() { int number,guess; srand(time(NULL)); // this is the function to generate a random number between 0 and 1.. number=rand()%2;  // this is the actual operation for 1 and 0.. // if no. is even it gives 0 and 1 otherwise.. printf("\n \t ENTER 1 FOR TAIL AND 0 FOR HEAD : "); scanf("%d",&guess); printf(" \n THE RESULT OF THE TOSS IS :  "); // testing the condition for head or tail... if(number==0) printf(" head  \n !!!"); else printf("tail \n"); printf(" You guessed "); if(guess==0) printf("Head\n"); else printf("Tail \n"); if(number ==guess) printf(" hurray ! you won the toss !!!"); else printf(" bad luck !!\n Better luck next time : : "); } ...

Program to create pyramid in C language

C PROGRAM TO MAKE A RIGHT POINTED PYRAMID #include<stdio.h> main() { int i,j,k,row,count,temp; printf("\t ENTER THE NUMBER OF THE ROWS : "); scanf("%d",&row); for(i=1;i<=row;i++) { for(j=1;j<=i;j++) { printf("* "); } printf("\n"); } for(i=row-1;i>=1;i--) { for(j=i;j>=1;j--) { printf("* "); } printf("\n"); } } click here  for my youtube channel

Program to create X pattern in C language

C PROGRAM TO CREATE X PATTERN #include<stdio.h> main() {      int len,i,j,row;      printf("\n ENTER THE NUMBER OF THE ROWS : ");      scanf("%d",&row);      for(i=1;i<=row;i++)  // for loop for the rows ..      {           for(j=0;j<row;j++)   //for loop for the columns...           {           if(i==j||i+j==row -1) // this is the main logic for the required pattern..           {                printf("*");           }           else{                printf(" ");   // white space where it should be blank..          }  ...

Program to create a Square pattern

C program to generate a square in C language #include<stdio.h> main() { int i,j,n; printf("\t enter size of square to generate a square :  "); scanf("%d",&n); for(i=1;i<=n;i++)  // for row { for(j=1;j<=n;j++)  // for column  { if(i==1||i==n) // to fill the first and last line.. printf("S ");   //print  s in first and last line .. else{                // condition for remianing lines.. if(j==1||j==n)    // condition for first and last column printf("S ",j);  // prints the s in first and last column .. else     printf("  ");  // leave space for remaining rows .. } } printf("\n"); // print new line after every row... } } Watch video : https://youtu.be/hKxYeZ5To9Q