Pages

Saturday, November 30, 2013

Introduction of C





Refference by Syed Zulqurnain Jaffery & Ms. Shahina Naz

Write a program of addition of two characters in C

Source Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include <stdio.h>
#include <conio.h>
void main (void)
{
 char ch1, ch2, sum; 
         ch1 = '5' ;
 ch2 = '9' ;
 sum = ch1 + ch2;
 printf("Sum = %d", sum);
   getch();
}// main

Result:

Sum = 109

Write a program that converting Centigrade temperatures to Fahrenheit in C

Formula: F = 32 + (C * 180.0/100.0)

Source Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  #include <iostream.h>
  #include <conio.h>
  void main(void)
  {  
   clrscr ();
   float F, C;
    C    =   -10;
    F    = 32 + (C * 180.0/100.0);
  printf("F = %2.2f",F);  // use field-width specifier 
     getch();
         } //main

Result:

F = 14.00

Write a program to calculate and print the area of a square in C

Source Code:


1
2
3
4
5
6
7
8
9
#include <stdio.h>
#include <conio.h>
void main (void)
{
   int Height, Width, Area; 
   Height = 8, Width = 5;
   printf("Area of Square = %d", Area);
   getch ();
}// main

Result:


Area of Square = 40

Write a program that subtract two floating point numbers and shows their sum on the screen in C

Source Code:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include <stdio.h>
#include <conio.h>
void main (void)
{
   Float Num1, Num2, Sub;
   Num1 = 8;
   Num2 = 5;
   Sub = Num1 - Num2;
   printf("%2.2f + %2.2f  = %2.2f ", Num1, Num2, Sub);
   getch ();
      }// main

  Result:


65.77  24.27 = 41.5

Write a program that print "Assalam O Alikum!!! World" in C

Input:

#include <stdio.h>
#include <conio.h>
void main (void)
{
     printf("Assalam O Alikum!!! World");
     getch ();
     } // main

Output:

Assalam O Alikum!!! World

Friday, November 08, 2013

Contact

              If you have any problem to understand any program , you want any help/guid, find any error in program and want to tell us or want to give any feedback, want to encourage us, just feel free to contact us. We will try to reply you soon. You also send E-main on hearty.422422@gmail.combe Happy and enjoy learning!!!!!