Wednesday, September 29, 2010

Program for sub and borrow

#include<stdio.h>
#include<conio.h>
void main()
{
  int a,b,c,v,s;
  clrscr();
  printf("Program for sub and borrow: \n");
  printf("\nEnter the 1st number : ");
  scanf("%d",&a);
  printf("\nEnter the 2nd number : ");
  scanf("%d",&b);
  printf("\nEnter the 3rd number : ");
  scanf("%d",&c);
  v=((!a&&b)||(!a&&c)||(a&&b&&c));
  s=((!a&&!b&&c)||(!a&&b&&!c)||(a&&!b&&!c)||(a&&b&&c));

 printf("\ndiff :%d",s);

 printf("\n\nborrow : %d",v);
   getch();
}
/*
OUTPUT:

Program for sub and borrow:

Enter the 1st number :1

Enter the 2nd number :1

Enter the 3rd number :1

diff:1

borrow:1

*/                                           

No comments:

Post a Comment