Skip to main content
C++

C++ Tingz

By December 28, 2019No Comments
Notes from Udacity’s C++ Nanodegree
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++;
}
}

Leave a Reply