// Hi there, I'm new to programming and I'm starting off with C++;
// The program for the task must be written using a while loop only; but I am open to any other ways of writing the program; this is what I have so far, but whenever I insert x it only doubles once and keeps repeating the result without doubling.
#include <iostream>
using namespace std;
int main()
{
int x = 0, ind = 2, prod;
cout << " Hey! What's the initial value of your variable ? ";
cin >> x;
while (x < 100)
{
prod = x * ind;
cout << prod;
}
return 0;
}
— Regards
Aucun commentaire:
Enregistrer un commentaire