Question: Exercise 2.9. Rewrite the product function of Exercise 2.8 using a for loop. exercise 2.7 code: #include int main() { int n,product=1,i=1; printf(Enter n value

Exercise 2.9. Rewrite the product function of Exercise 2.8 using a for loop.

exercise 2.7 code:

#include int main() { int n,product=1,i=1; printf("Enter n value : "); scanf("%d",&n); printf("i\tproduct "); while(i<=n) { printf("%d\t %d ",i,product); product *= i; i++; } printf("product of %d numbers are = %d ",i,product); return 0; }

language is in c.

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!