#include<iostream>
#include<conio.h>
using namespace std;
int main()
{int a,b,c=0,i,f;
cout<<"Enter two numbers to substract :";
cin>>a>>b;
if(b>a)
{i=a;f=b;}
else
{i=b;f=a;} // i initial value f final value
for( ;i<f;i++)
++c;
(b>a)? //conditional operators eqivalent to if (b>a)
cout<<a <<" - " <<b<< " = "<<(char)45<< c //ASCII value of 45 is minus -
: // else
cout<<a <<" - " <<b <<" = "<< c;
getch();
}
visit computerstechnology
Facebook Devgroup
#include<conio.h>
using namespace std;
int main()
{int a,b,c=0,i,f;
cout<<"Enter two numbers to substract :";
cin>>a>>b;
if(b>a)
{i=a;f=b;}
else
{i=b;f=a;} // i initial value f final value
for( ;i<f;i++)
++c;
(b>a)? //conditional operators eqivalent to if (b>a)
cout<<a <<" - " <<b<< " = "<<(char)45<< c //ASCII value of 45 is minus -
: // else
cout<<a <<" - " <<b <<" = "<< c;
getch();
}
visit computerstechnology
Facebook Devgroup
No comments:
Post a Comment