+ 1
why we write x<5 in that we can write x<=4đ
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
0
Both do essentially the same thing. Use whatever one you like.
0
which one is better to use
0
x<=4 is a lot more straightforward, I would go with that one just out of convience.
0
its ur choice the actual meaning remains the same.
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.
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 ();
}