Write a macro to display the string COBOL in the following pattern. C CO COB COBO COBOL

Advertisement
Write a macro to display the string COBOL in the following pattern.
C
CO
COB
COBO
COBOL

Ans.
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
char arr[5]={‘c’,’o’,’b’,’o’,’l’};
clrscr();
for(i=0;i<=4;i++)
{
for(j=1;j<=i-1;j++)
{
printf(“%s”,arr[i]);
}
printf(“n”);
}
getch();

}
You Can Sale and Purchaser Solved Assignment Contact us:- ignouassignmentguru@gmail.com
Previous
Next Post »
Thanks for your comment