Sunday, 17 June 2012

Sir Asdullah Bhatti The 8th lecture



LECTURE#08
IMPLEMENTATION OF ARITHMATIC OPERATORS

REFERENCES


PBB

3

#include<conio.h>
#include<stdio.h>
main()
{
      //implementation of arithmatic operators
      int x,y;
      printf("Enter first value:");scanf("%d",&x);
      printf("Enter second value:");scanf("%d",&y);
      printf("\n\n");
      printf("\nSum = %d",x+y);
      printf("\nDiff = %d",x-y);
      printf("\nProduct = %d",x*y);
      printf("\nDivision = %d",x/y);
      getch();}



4



#include<conio.h>
#include<stdio.h>
main()
{
      //use of %d - Format Specifier in printf function
     
      int x,y;
     
      printf("Enter first value:");scanf("%d",&x);
      printf("Enter second value:");scanf("%d",&y);
     
      printf("\n\n");
      printf("\n %d + %d = %d",x,y,x+y);
      printf("\n %d - %d = %d",x,y,x-y);
      printf("\n %d * %d = %d",x,y,x*y);
      printf("\n %d / %d = %d",x,y,x/y);
     
     
      getch();}



6



#include<conio.h>
#include<stdio.h>
main()
{
      //Precedence of operator
     
      printf(" %d ",4+5*6);
      printf("\n");
      printf(" %d ",(4+5)*6);
     
     
      getch();}

No comments:

Post a Comment