Tuesday, April 7, 2015

46. What is nested loop? Write a program to display the multiplication table of nth term of given numbers [2070 set C]


#include <stdio.h>
#include <conio.h>
void main()
{
int i,j,n,x,num[50];
clrscr();
printf("\n How many numbers:- ");
scanf("%d",&n);
printf("\n Input %d numbers:- ",n);
for(i=0;i<n;i++)
scanf("%d",&num[i]);
printf("\n Upto how much terms:- ");
scanf("%d",&x);
for(i=0;i<n;i++)
{
  for(j=0;j<=x;j++)
   printf("\n %d x %2d= %4d",num[i],j,num[i]*j);
}
getch();
}

No comments:

Post a Comment