Wednesday, September 5, 2012

C language program examples

Write C program to declare two variable named a and b with some float value and print the addition subtraction, multiplication and division of this two numbers. 

#include<stdio.h>
#include<conio.h>
void main()
{
      float a,b,c;
      clrscr();


       a=20;
       b=10;


       c=a+b;
       printf("\n Addition of a and b = %f",c);

       c=a-b;
       printf("\n\n Subtration of a and b = %f",c);

       c=a*b;
       printf("\n\n Multiplication of a and b = %f",c);

       c=a/b;
       printf("\n\n Division of a and b = %f",c);
       getch();
 }

No comments:

Post a Comment