48. WAP to display multiplication table of a given input number.
#include<stdio.h>
void
main()
{
int num,order,i=1,j=10;
printf(" WAP to display multiplication
table of a given input number\n");
printf("Enter the number : ");
scanf("%d",&num);
printf("Which order : 1)Ascending
order 2)Descending order : ");
scanf("%d",&order);
switch(order)
{
case 1:;
L1:
printf("%d * %d =
%d\n",num,i,num*i);
i++;
if(i<=10)
goto L1;
printf("Table of %d in ascending order
\n",num);
break;
case 2:;
L2:
printf("%d * %d =
%d\n",num,j,num*j);
j--;
if(j>=1)
goto L2;
printf("Table of %d in descending
order \n",num);
break;
}
}
Comments
Post a Comment