25.Printing the table using Array and Function call taking input from user
#include <stdio.h>
void mul(int *a, int value,int col)
{
printf("The multi[lication table of %d: is\n", value);
for (int i = 0; i < col; i++)
{
a[i] = value * (i + 1);
}
for (int i = 0; i < col; i++)
{
printf("%d X %d = %d\n\n", value, i + 1, a[i]);
}
// printf("******************************************\n");
}
int main()
{
int rows, coloumns;
int value;
printf("Enter the size of row and coloumn :");
scanf("%d%d", &rows, &coloumns);
int arr[rows][coloumns];
for (int i = 0; i < rows; i++)
{
printf("\nEnter the vaule :");
scanf("%d", &value);
mul(arr[i], value,coloumns);
}
return 0;
}
Comments
Post a Comment