
Notes from Udacity’s C++ Nanodegree
{
// Write your code here.
int i = 1;
while(i <= 10) {
if(i % 2 == 0) {
cout << i << “\n”;
}
i++;
}
}
Function to print out even numbers
/* Inside the int main function there is a while loop there is an if conditional statement within the while loop the function willl print out even numbers from 1- 10 So long as OR while i is less than 10 */ int main(){
// Write your code here.
int i = 1;
while(i <= 10) {
if(i % 2 == 0) {
cout << i << “\n”;
}
i++;
}
}