Print out all numbers between 0 & 1000 which are evenly divisible by three OR seven. Print them on different lines.Print out all numbers between 0 & 1000 which are evenly divisible by three OR seven. Print them on different lines.
7) Write a loop which prints out every third number between 11 & 21 inclusive.
8) Write a loop which calculates 5 factorial.
9) Write a loop which calculates the average of all of the numbers which are evenly divisible by 3 and lie between 70 & 101 inclusive. The average should be a double.
10) Write a loop which sums up 1/20 + 1/19 + 1/18 +...1/2.
1
Expert's answer
2011-10-07T08:21:05-0400
#include <stdio.h>
//~ Print out all numbers between 0 and 1000 which are evenly divisible by three OR seven. //~ Print them on different lines. void PrintDiv3_7() { int i=0; int cnt3=0; // counter of period 3 int cnt7=0; // counter of period 7 while (i<1001)
//~ 7) Write a loop which prints out every third number between 11 and 21 inclusive. void PrintEveryThird() { int i; for (i=11+2; i<22; i+=3) { printf("%d ", i); }; printf("\n\n"); };
//~ 8) Write a loop which calculates 5 factorial. void Calc5Fact() { int i; int f=1; for(i=2; i<6; i++) f*=i;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment