Tag Archives: pattern

Write a Program in ‘C’ to print the following output ‘n’ rows. 10m june2009

Write a Program in ‘C’ to print the following output ‘n’ rows. For example, if n=3, the following should be output by the program: 10m june2009   #include <stdio.h> void main() { int I,J,N=3,K=0,ODD=1,SPACE; clrscr(); SPACE=N; for(I=1;I<=N;I++) { for(J=1;J<SPACE;J++) { printf(” “); } K=0; for(J=1;J<=ODD;J++) { if(J<=I) { K++; } else { K–; } printf(“%d… Read More »

Write a program and flowchart to display the following pattern: 6m Jun2008

Write a program and flowchart to display the following pattern: 6m Jun2008 1 2 3 4 5 6 7 8 9 1 0 11 12 13 14 15 16 17 18 19 20 21   Code: #include<stdio.h> void main() { int I,J,C=1; clrscr(); printf(“Result :\n”); for(I=0;I<6;I++) { printf(“\n”); for(J=0;J<=I;J++) { printf(“%d “,C++); } printf(“\n”); }… Read More »

Write a program to generate the pattern 10m Jun2007

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()… Read More »