We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Introduction
- For Loop
- Discussions
For Loop
For Loop
Sort by
recency
|
1639 Discussions
|
Please Login in order to post a comment
int main() { int a , b; cin>>a; cin>>b; // Complete the code. for(int i=a;i<=b;i++ ,a++){ if(i==1){ cout<<"one\n"; } else if (i==2){ cout<<"two\n"; } else if (i==3){ cout<<"three\n"; } else if (i==4){ cout<<"four\n"; } else if (i==5){ cout<<"five\n"; } else if (i==6){ cout<<"six\n"; } else if (i==7){ cout<<"seven\n"; } else if (i==8){ cout<<"eight\n"; } else if (i==9){ cout<<"nine\n"; } else if(i%2==0){ cout<<"even\n"; } else{ cout<<"odd\n"; } }
}
include
using namespace std;
int main() { int a, b; cin >> a >> b;
}
include
include
using namespace std;
int main() { int a,b; cin>>a; cin>>b; string s[20]={"one","two","three","four","five","six","seven","eight","nine"};
}
I'm working on a website and need help adding a C++ loop to my code. The loop should generate a series of numbers based on specific start, stop, and step values, and display the results in real-time on the website. Any suggestions or tips from experienced developers would be greatly appreciated.