Write a program to generate the pattern 10m Jun2007

By | July 11, 2014

Write a program to generate the pattern 10m Jun2007

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

 

Code:

 

#include<stdio.h>
void main()
{
char C[]=”12345″;
int I,J;
clrscr();
printf(“Result :\n”);
for(I=0;I<5;I++)
{
printf(“\n”);
for(J=0;J<=I;J++)
{
printf(“%c “,C[J]);
}
printf(“\n”);
}
getch();
}

[codesyntax lang=”c”]

#include<stdio.h>
void main()
{
char C[]="12345";
int I,J;
clrscr();
printf("Result :\n");
for(I=0;I<5;I++)
{
printf("\n");
for(J=0;J<=I;J++)
{
printf("%c ",C[J]);
}
printf("\n");
}
getch();
}

[/codesyntax]

Screen Shots:

C_program_Format_1to5

 

C_program_Format_1to5_Output

 

 

When can 2 matrices of order a x b and c x d be multiplied? Also write a program in C to find the product of 2 such matrices. 10m Jun2007

Solved program can be found on this link http://cssimplified.com/c-programming/an-interactive-c-program-to-multiply-two-matrices

Leave a Reply