Posts

Showing posts from July, 2012

SNAK GAME IN C

Graphics Programming in c (RAIN)

4. Write a program to read a text file “brijesh.txt “ count and display the number of alphanets present in it.

#include <stdio.h> #include <stdlib.h> #include <string.h> #include<conio.h> int main(void) { char str[80]; int l=0; clrscr(); FILE *fp; if((fp = fopen("brijesh.txt", "w"))==NULL) { printf("Cannot open file.\n"); exit(1); } do { printf("Enter a string :\n"); gets(str); l=strlen(str); printf("charecter lenth are\t%d\n",l); strcat(str, "\n"); /* add a newline */ fputs(str, fp); } while(*str!='\n'); return 0; }

6. Write a program to create a text file which contain some text.

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char str[80]; FILE *fp; if((fp = fopen("brijesh.txt", "w"))==NULL)  { printf("Cannot open file.\n"); exit(1); } do { printf("Enter a string (CR to quit):\n"); gets(str); strcat(str, "\n"); /* add a newline */ fputs(str, fp); } while(*str!='\n'); return 0; }

c program for swapping with the help of pointer

#include<stdio.h> #include<conio.h> void swap(int*,int*); void main() {   int a,b;   clrscr();   printf("enter two value\n");   scanf(" %d%d",&a,&b);   swap(&a,&b);   getch();   }   void swap(int *a,int *b)   {    int *c;    *c=*a;    *a=*b;    *b=*c;    printf("value Are=%5d\t%d",*a,*b);    }

ALL DOS COMMAND

C program for conver kilometer into inch ,feet,centimeter and meter

#include<stdio.h> #include<conio.h> void main() { float km,m,cm,ft,inch; clrscr(); printf("enter the distance in kilometres "); scanf("%f",&km); m=km*1000; cm=m*100; C inch=cm/2.54; ft=inch/12; printf(" distance in meters is %f",m); printf(" distance in centimetres is %f",cm); printf(" distance in feet is %f",ft); printf(" distance in inches is %f",inch); getch(); }

C code for Addition of two complex number

Image
#include<stdio.h> #include<conio.h>  struct com  {   int a,b;   int x,y;   int add1,as;   }c;   void main()   {    clrscr();    printf("enter 1st  part of comlex number");    scanf("%d%d",&c.a,&c.b);    printf("enter imaginary part of number\n");    scanf("%d%d",&c.x,&c.y);    printf("Number are=%5d+i%d\n",c.a,c.x);    printf("Number are=%5d+i%d",c.b,c.y);      c.add1=c.a+c.b;      c.as=c.x+c.y;    printf("Addition are=%5d+i%d",c.add1,c.as);    getch();    }

Program to find handsome number

Image
//handsome Number #include<stdio.h> #include<conio.h> void main()  {    int num,r,rev=0,r1,sum=0;    clrscr();    printf("enter number\t");    scanf("%d",&num);    while(num>0)    {     r=num%10;     rev=rev*10+r;     num=num/10;     }       while(rev>9)    {     r1=rev%10;     sum+=r1;     rev=rev/10;    }    if(sum==rev)      printf("Handsome number\n");    else      printf("Not handsome number");     getch();     }

Find smallest in four number by using Ternery operator

//By Brijesh #include<stdio.h> #include<conio.h> void main()  {    int a,b,c,d,ans;    clrscr();    printf("enter the  4 value \n");    scanf("%d%d%d%d",&a,&b,&c,&d);    ans=(a>b&&a>c&&a>d)?a:(b>a&&b>c&&b>d)?b:(c>a&&c>b&&c>d)?c:d;    printf("greatest=\t%d",ans);    getch();  }

Print the Number table

/* Printing table    5    5 4    5 4 3    5 4 3 2    5 4 3 2 1            */          #include<stdio.h>          #include<conio.h>          void main()           {         int i,j;         clrscr();         for(i=5;i>0;i--)          {           for(j=5;j>=i;j--)            {             printf("%2d",j);            }           printf("\n");           }       ...

Addition,Substrction ,Multiplication And Compare of two Matrix

//Brijesh #include<stdio.h> #include<conio.h> void main() {  int a[100][100],b[100][100],add[100][100],sub[100][100],mul[100][100],r,c;  int i,j,flag=0;  clrscr();  printf("enter the size of matrix (ROW AND COL)\n");  scanf("%d%d",&r,&c);  printf("Enter the element into matrix\n");  for(i=0;i<r;i++)  {   for(j=0;j<c;j++)    {     scanf("%d",&a[i][j]);     }  }    printf("Enter the element into 2nd matrix\n");  for(i=0;i<r;i++)  {   for(j=0;j<c;j++)    {     scanf("%d",&b[i][j]);     }  }  //for addition   for(i=0;i<r;i++)  {   for(j=0;j<c;j++)    {    add[i][j]=a[i][j]+b[i][j];    }  }  printf("Addition\n");  for(i=0;i<r;i++)  {   for(j=0;j<c;j++)    {    printf("%5d",add[i][j]); ...

Increase Internet speed

Here i telling you how to increase your internet speed by following some steps: but i dont say it work all OS . step 1 open cmp and go to root and type command "gpedit.msc" and press enter step 2  a window open "local group and policy editor" step 3 now expand the" administrative templete" step 4 then expand the network and then click "Qos packet scheduler "open it and            edit the "limit reservable bandwidth . step 5 click enable and set bandwidth. Internet speed