Saturday 31 August 2013

Computer Programming


Hello Friends !!
We are Provide You The all Solution About the All Programming Languages and Their Tricks !!!!


What is source code? 
A series of commands, in the form of text, that tell the computer exactly what to do. 

What is machine language? 
Machine language, also known as binary, is a number system of 1's and 0's that the computer can understand. Consider a switch; a 1 would represent that the switch is in the on position, and a 0 would represent that the switch is off. Now think of millions of switches like that, and millions of 1's and 0's. That is all the computer knows. 

What is a programming language? 
Because the binary system is extremely difficult , and impractical to learn, we use programming languages. Programming languages are a common ground of understanding between the computer and you. Programming languages are created by humans however, subsequently giving each one specific advantages and disadvantages. 


Now , we are going to teach you first how to create a simple hello world programm in C in windows Operating System.
First You Need to Download Turbo C. from the link is given below Click Here.
How to install TURBO C++ for windows xp and 7.
1. First of all download the compiler from the link given above.
2. Now extract the zip file and than open TC3SETUP.
3. After that click on Unzip. You can also change the path where you want to install it.
4. By default it is installed in C:\TC.

How to create Simple C Programm to Print Hello.
#include"stdio.h"
#include"conio.h"
void main()
{
         clrscr();
         printf("Hello");
         getch();
}
Output :-Hello

How to Add two Values using C.
#include"stdio.h"
#include"conio.h"
void main()
{
         int a,b,c;
         clrscr();
         a=10;
         b=30;
         c=a+b;
         printf("Addition is : ",c);
         getch();
}
Output :-Addition is : 40

Linear Search

How To Apply Linear Searching in C

#include<stdio.h>
#include<conio.h>
void main()
{
   int array[100], search, c, number;
  clrscr();
   printf("Enter the number of elements in array\n");
   scanf("%d",&number);

   printf("Enter %d numbers\n", number);

   for ( c = 0 ; c < number ; c++ )
      scanf("%d",&array[c]);

   printf("Enter the number to search\n");
   scanf("%d",&search);

   for ( c = 0 ; c < number ; c++ )
   {
      if ( array[c] == search )     /* if required element found */
      {
         printf("%d is present at location %d.\n", search, c+1);
break;
      }
   }
   if ( c == number )
      printf("%d is not present in array.\n", search);     

   getch();

}

OUTPUT:-


How to Find Leap Year In C

How to Find Leap Year Using C Programm

#include <stdio.h>
#include<conio.h>
void main()
{
  int year;
  clrscr();
  printf("Enter a year to check if it is a leap year\n");
  scanf("%d", &year);

  if ( year%400 == 0)
    printf("%d is a leap year.\n", year);
  else if ( year%100 == 0)
    printf("%d is not a leap year.\n", year);
  else if ( year%4 == 0 )
    printf("%d is a leap year.\n", year);
  else
    printf("%d is not a leap year.\n", year);  

 getch();

}

OUTPUT :->


Fabonnaci Series

How to print fabonnaci series in C programming

#include<stdio.h>
#include<conio.h>
void main()
{
   int n, first = 0, second = 1, next, c;
   clrscr()
   printf("Enter the number of terms\n");
   scanf("%d",&n);

   printf("First %d terms of Fibonacci series are :-\n",n);

   for ( c = 0 ; c < n ; c++ )
   {
      if ( c <= 1 )
         next = c;
      else
      {
         next = first + second;
         first = second;
         second = next;
      }
      printf("%d\n",next);
   }

  getch();

}

Output :-


Friday 30 August 2013

How To Print Diamond Pattern In C

Print Daimond Pattern In C

#include<stdio.h>
#include<conio.h>

void main()
{
   int row, c, n, temp;
   clrscr();
   printf("Enter the number of rows in pyramid of stars you wish to see ");
   scanf("%d",&n);

   temp = n;

   for ( row = 1 ; row <= n ; row++ )
   {
      for ( c = 1 ; c < temp ; c++ )
         printf(" ");

      temp--;

      for ( c = 1 ; c <= 2*row - 1 ; c++ )
         printf("*");

      printf("\n");
   }

   getch();

}

Output : 


Addition of Two Complex Numbers using Structure

How To Add Two Complex Number in C using Structure.

#include <stdio.h>

struct complex
{
   int real, img;
};

main()
{
   struct complex a, b, c;

   printf("Enter a and b where a + ib is the first complex number.\n");
   printf("a = ");
   scanf("%d", &a.real);
   printf("b = ");
   scanf("%d", &a.img);
   printf("Enter c and d where c + id is the second complex number.\n");
   printf("c = ");
   scanf("%d", &b.real);
   printf("d = ");
   scanf("%d", &b.img);

   c.real = a.real + b.real;
   c.img = a.img + b.img;

   if ( c.img >= 0 )
      printf("Sum of two complex numbers = %d + %di\n",c.real,c.img);
   else
      printf("Sum of two complex numbers = %d %di\n",c.real,c.img);

   return 0;

}

Output :- 




How To Add Two Matrix In C

Addition of Two Matrix in C


#include <stdio.h>
#include <conio.h>
void main()
{
   int m, n, c, d, first[10][10], second[10][10], sum[10][10];
   clrscr();
   printf("Enter the number of rows and columns of matrix ");
   scanf("%d%d", &m, &n);
   printf("Enter the elements of first matrix\n");
   for ( c = 0 ; c < m ; c++ )
      for ( d = 0 ; d < n ; d++ )
         scanf("%d", &first[c][d]);
   printf("Enter the elements of second matrix\n");
   for ( c = 0 ; c < m ; c++ )
      for ( d = 0 ; d < n ; d++ )
            scanf("%d", &second[c][d]);
   for ( c = 0 ; c < m ; c++ )
      for ( d = 0 ; d < n ; d++ )
         sum[c][d] = first[c][d] + second[c][d];
   printf("Sum of entered matrices:-\n");
   for ( c = 0 ; c < m ; c++ )
   {
      for ( d = 0 ; d < n ; d++ )
         printf("%d\t", sum[c][d]);
      printf("\n");
   }
   getch();
}

Output :-