Create a free account on Computer Sir Ki Class and unlock access to valuable learning resources.
Exam Paper Downloads: After registering and logging in, you can download exam question papers in PDF format to practice and prepare for your exams.
Student Support: Get assistance with your doubts, queries, and questions related to your studies. Our support is here to help you understand topics and resolve your learning difficulties.
Register today and make your exam preparation easier and more effective!
Related codes are those codes where similar programming concepts are in use. They are different from alternate codes in the sense that they may not have same purpose and results.
:
Solution
Run Output
25 20 15 10 5
The program can be rewritten as follows.
#include <iostream>
using namespace std;
int main()
{
int i=50; //The first instruction of for loop comes before while loop
while(i>=10) //The condition check remains here after while
{
cout<<i/2<<" "; //These are body instructions
i-=10; //The update instruction comes here as last instruction of loop body.
}
return 0;
}