+ 1
can we used only if statement without else statement give example also
6 odpowiedzi
+ 1
int x=3
if (x<5)
{cout<<x is smaller}
+ 1
Yes.
int greatest(int x, int y){
if(x > y)
return x;
return y;
}
int main(){
int i;
int j;
cin >> i >> j;
cout << greatest(i, j);
return 0;
}
+ 1
yes , if can exist without else but vice-versa will give you an error
0
Yes that's possible ! My friends have already provided examples
0
yah thats very posible,
bt in the case of else,we cannot use it without a coresponding if
- 1
yes. try this one.
#include<stdio>
using namespace std;
int main()
{
int a,b;
cout<<"enter two values";
cin>>a>>b;
cout<< (a>b)?a:b;
return 0
}