Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main(){
- int columns;
- int rows;
- int rowcount , columcount;
- int x , k , y , z;
- k = 3;
- z = 3;
- /*this creates the input screen*/
- printf("\t\t\t\t\tMultiplikationstabelle\n\n");
- printf("Geben Sie die gewuenschte Anzahl von Reihen und Spalten ein:\n");
- printf("Spalten:(2-13)");
- scanf("%d",&columcount);
- printf("Reihen(1-769):");
- scanf("%d",&rowcount);
- /*this checks that the input is within the parameters*/
- if(columcount>13){
- columcount=13;
- printf("Spalten konnten nicht mehr als 2 sein\n");
- y = 14;
- }else{
- if(columcount<2){
- columcount=2;
- printf("Spalten konnten nicht weniger als 2 sein\n");
- y = 3;
- }else{
- columcount=columcount;
- y = columcount + 1;
- }
- }
- if(rowcount>769){
- rowcount=769;
- printf("Reihen konnten nicht mehr als 769 sein\n");
- }else{
- if(rowcount<1){
- rowcount=1;
- printf("Reihen Konnten nicht weniger als 1 sein\n");
- }else{
- rowcount=rowcount;
- }
- }
- /*this creates the header*/
- printf(" 1 2");
- while(k<y){
- if(k>=10)
- break;
- printf(" %d",k);
- k++;
- }
- while(k<y){
- printf(" %d",k);
- k++;
- }
- printf("\n ------------");
- while(z<y){
- printf("--------");
- z++;
- }
- z = 1;
- printf("------\n");
- /*this creates the table*/
- for(rows=1; rows <= rowcount; rows++){
- printf("%d. \t[ ", rows);
- for(columns=1; columns <= columcount; columns++){
- x=rows*columns;
- if(x<10){
- printf(" %d \t", x);
- }else{
- if(x<100){
- printf(" %d \t", x);
- }else{
- if(x<1000){
- printf(" %d \t", x);
- }else{
- printf("%d \t", x);
- }
- }
- }
- }
- printf(" ]\n");
- }
- /*This Creates the Footer*/
- printf(" --");
- while(z<y){
- printf("--------");
- z++;
- }
- printf("\n");
- return z;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement