+ 1

why we write x<5 in that we can write x<=4👍

30th Jul 2016, 12:33 AM
shivam kumar
shivam kumar - avatar
7 Answers
+ 2
There is no difference at all. Use whichever one you prefer, and if necessary, use whichever one will make the program you're writing as easiest to understand as possible. If you really want to be picky, x<5 is one less character than x<=4 :p
30th Jul 2016, 12:40 AM
Cohen Creber
Cohen Creber - avatar
0
Both do essentially the same thing. Use whatever one you like.
30th Jul 2016, 12:35 AM
Cohen Creber
Cohen Creber - avatar
0
which one is better to use
30th Jul 2016, 12:37 AM
shivam kumar
shivam kumar - avatar
0
x<=4 is a lot more straightforward, I would go with that one just out of convience.
30th Jul 2016, 12:49 AM
sammy
0
its ur choice the actual meaning remains the same.
30th Jul 2016, 4:24 AM
Mohit Jain
Mohit Jain - avatar
0
if i is a variable and u can use 5 time to display then u write i=0 then I<=4(this is condition) or if I=1 the u put I=1 and I<=5.
30th Jul 2016, 5:36 AM
meherDev
meherDev - avatar
0
for example.. display ur name 5 times on the screen.. #include<iostream> using namespace std; int main() { int x; for(i =0; i<5;i++) { cout<<"Mohammad Ali"<<x<<endl; getch (); } or #include<iostream> using namespace std; int main() { int x; for(i=1; i<=5; i++) { cout<<"Mohammad Ali"<<x<<endl; getch (); }
30th Jul 2016, 5:50 AM
meherDev
meherDev - avatar