|
|
 This is only a preview of the paper Click here to register and get the full text. Existing members click here to login
|
|
|
Lab05 Answer (for Lab Project) // prog01.c Multiplication table #include main() {int i, j; for (i=1;i<=9;i++){ for (j=1;j<=9;j++) printf("%3d", i*j ); printf(" "); } return 0; } ********************************************************************************** // prog02.c Upper half of multiplication table #include main() {int i, j; for (i=1;i<=9;i++){ for (j=1;j main() { int i, input, product, sum=0; do { printf("Please input an integer from 1 to 9 (both inclusive): "); scanf("%d",&input); if (input>9) printf("Input is > 9. Please enter again: "); else if (input<1) printf("Input is < 1. Please enter again: "); } while (!(input<10 && input>0)); for (i=1;i<=9;i++) { product = input * i; printf("%d ",product); sum+=product; } printf(" The sum of this row is %d. ", sum); return 0; } ********************************************************************************** //prog06.c Using the library function pow( ) #include #include int main() { int i; float x, y; double result; for (i=1; i<=3; i++) { printf("Please input a number: " ); scanf("%f",&x); printf("Please input the exponent: " ); scanf("%f",&y); if (x==0&&y<=0) printf("Undefined!
Approximate Word count = 701 Approximate Pages = 2.8 (250 words per page double spaced)
|
|
|
|
|
|