Browse Source

Added files

master
Rainer Hihn 3 years ago
parent
commit
4a05b3d9dc
2 changed files with 73 additions and 0 deletions
  1. +35
    -0
      forLoop.c
  2. +38
    -0
      whileLoop.c

+ 35
- 0
forLoop.c View File

@@ -0,0 +1,35 @@
/*
* Multiplikationstabelle mit for-Schleife
*
* by Rainer Hihn
*/
#include <stdio.h>

int main(void) {
/*
* vertical and horizontal limit
*/
int hlimit;
int vlimit;
scanf("%d", &hlimit);
scanf("%d", &vlimit);
/*
* for loop vars
*/
int i;
int j;
for(i = 1; i <= vlimit; i++) {
for(j = 1; j <= hlimit; j++) {
printf("%d\t", i*j);
}
printf("\n");
}
printf("\n");
return 0;
}

+ 38
- 0
whileLoop.c View File

@@ -0,0 +1,38 @@
/*
* Multiplikationstabelle mit while-Schleife
*
* by Rainer Hihn
*/
#include <stdio.h>

int main(void) {
/*
* vertical and horizontal limit
*/
int hlimit;
int vlimit;
scanf("%d", &hlimit);
scanf("%d", &vlimit);
/*
* while loop vars
*/
int i = 1;
int j = 1;
while(i <= vlimit) {
while(j <= hlimit) {
printf("%d\t", i*j);
j++;
}
j = 1;
i++;
printf("\n");
}
printf("\n");
return 0;
}

Loading…
Cancel
Save