CPS 109 Study Guide - Quiz Guide: Conversion Of Units, Mechagodzilla, Fibonacci Number

304 views12 pages

Document Summary

In each of the following program files, the part that you had to write is between the and comments. Uses a for-loop to add the values from 1 to 1000 public class adderfor public static void main(string[] args) Define a local integer constant called limit equal to 1000 final int limit = 1000 ; // 1. write a for-loop with an index going from 1 to limit; 2. add the index values as sum for (int i = 0 ; i <= limit ; i++) { sum += i ; Uses a while loop to add the values from 1 to 1000 public class adderwhile public static void main(string[] args) Uses a do-while loop to add the values from 1 to 1000 public class adderdo public static void main(string[] args) // 1. define a local integer constant called limit equal to 1000 final int limit = 1000 ;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions