Browse Source

Added files

master
Rainer Hihn 4 years ago
parent
commit
4a05b3d9dc
  1. 35
      forLoop.c
  2. 38
      whileLoop.c

35
forLoop.c

@ -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
whileLoop.c

@ -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