Wednesday, 23 April 2014

Declare two arrays A and B, find (i) A intersection B and (ii) A union B.

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,num_lines;
clrscr();
printf("\nEnter the number of lines to print: ");
scanf("%d", &num_lines);
for(i=1; i<=num_lines; i++)
{
for(j=1; j<=i; j++)
{
printf("%d ", i);
}
printf("\n");
}
getch();
}

No comments:

Post a Comment