CSC209H5 Chapter Notes - Chapter 2: Scanf Format String, A.Out, Gnu Compiler Collection

30 views3 pages

Document Summary

Csc209h5s - software programming and tools (winter 2018) Initialization - code that is executed before the loop begins. Condition - how long the loop body runs; if the condition is true, the loop will run. Initialize check condition (if true) loop body update. #include int main() { printf( ""cause the players gonna \n" ); int i; for (i = 0 ; i < 3 ; i ++) { printf( "%d\n" , i); printf( "play\n" ); #include int main() { int i; while (i < 5 ) { i++; printf( "%d\n" ,i); return 0 ; Loop body is executed one, then checks conditions to see if another loop is initiated. #include int main() { int sum = 0 ; int curr_int; do { printf( "enter an integer: " ); scanf( "%d" , &curr_int); sum += curr_int; } while (curr_int != 0 ); printf( "the total is %d\n" , sum); return 0 ;

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents