Hello Students, In this blog, I am about to share the solution of IGNOU MCS011 June 2022 Previous year question paper.
This is the second question of the question paper and the question is given below:
Write a program to display string ‘INFINITY’ in the following pattern (using ‘‘LOOP’’ control statement)
I
I N
I N F
I N F I
I N F I N
I N F I N I
I N F I N I T
I N F I N I T Y
Sol.
#include <stdio.h>
int main() {
char s[]="INFINITY";
int i,j;
for(i=0;s[i];i++)
{
for(j=0;j<=i;j++)
printf("%c",s[j]);
printf("\n");
}
return 0;
}
Above given solution is tested in an online compiler, so you can also check the solution by copy, paste the solution.
I hope you guys like this solution, if you like it then please follow and share it with your fellow students.