Thursday, February 24, 2011

Decision Making and Looping

Write a program to print 
S  S  S  S  S
S  S  S  S  S
S  S  O S  S
S  S  S  S  S
S  S  S  S  S


#include <stdio.h>

void main()
{
int row,column;
clrscr();
putchar('\n');
for(row=1;row<=5;row++)
{
for(column=1;column<=5;column++)
{
if(row==3&&column==3)
printf(" 0");
else
printf(" S");
}
putchar('\n');
}
getch();
}

No comments:

Post a Comment