Question: CSE 103: Computer Programming in C Lab #5: Repetition Structures Objective: Learn the Repetition Structures by covering the following loops: 1. while statement 2. for

 CSE 103: Computer Programming in C Lab #5: Repetition Structures Objective:

Learn the Repetition Structures by covering the following loops: 1. while statement

2. for statement ....+ N* Task 1: Counting Loops using while/for statements

CSE 103: Computer Programming in C Lab #5: Repetition Structures Objective: Learn the Repetition Structures by covering the following loops: 1. while statement 2. for statement ....+ N* Task 1: Counting Loops using while/for statements Write Compile & Run the following program in Dev-C++. Save the source file as prog1.c /* computing the summation: 1 + 2 + 3 + #include int main(void) { int n, i, sum; printf("Enter an integer number: "); scanf("%d",&N); sum = 0; //initialize sum by the additive Identity (zero) i = 1; //1. initialization while (i int main(void) { return 0; Task 3: Computing n! using another definition In mathematics, n! sometimes is defined as: n! = nx(n-1)x(n-2)...... 3 x 2 x 1 For example, 5! = 5 x 4 x 3x 2 x 1 = 120 Rewrite prog3.c to compute n! using this definition! Save the source file in as prog4.c Compile & Run the program in Dev-C++. /* computing n! as nx (n-1) x (n-2) ...... X 3 x 2 x 1 using for statement */ #include int main(void) return 0; Page 5 of 6 Task 4: Computing n! using while statement Rewrite prog4.c using while statement! Save the source file in as prog5.C Compile & Run the program in Dev-C++. /* computing n! as nx (n-1) x (n-2)x ... ... x 3 x 2 x 1 using while statement */ #include int main(void) 1 return 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!