Write a program to print a square of size 5 by using the
character S.
Answers were Sorted based on User's Feedback
Answer / gaurav_jain
/* I am using more brackets which can be ignore. */
#include<stdio.h>
main()
{
int i,j;
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if(i==0 || i==4)
{
printf("S");
}
else if(j==0 || j==4)
{
printf("S");
}
else
{
printf(" ");
}
}
printf("\n");
}
}
Is This Answer Correct ? | 35 Yes | 9 No |
Answer / chand
main()
{
for(int i=0;i<5;i++)
{
printf("\n");
if(i==0||i==4)
{
for(int j=0;j<5;j++)
printf("S");
}
else
printf("S S");
}
Is This Answer Correct ? | 19 Yes | 10 No |
Answer / riz
#include<stdio.h>
int main()
{
int i,j;
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf("S");
}
printf("\n");
}
}
Is This Answer Correct ? | 15 Yes | 10 No |
Answer / aditti saxena
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
n=5;
printf("\n\n");
for(i=1;i<=n;i++)
printf("s ");
printf("\n\n");
for(i=1;i<=n-2;i++)
{
printf("s ");
for(j=1;j<=n-2;j++)
printf(" ");
printf("s\n\n");
}
for(i=1;i<=n;i++)
printf("s ");
printf("\n");
getch();
}
Is This Answer Correct ? | 3 Yes | 3 No |
Answer / kiran
#include<stdio.h>
int main()
{
int i,j;
for(i=0;i<5;i++)
{
printf("
");
printf("
");
for(j=0;j<5;j++)
{
if(i==0 || j==0 || i==4 ||j==4 )
printf(" S ");
else
printf(" ");
}
}
}
Is This Answer Correct ? | 0 Yes | 1 No |
int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.
6 Answers Fusion Systems GmbH,
main() { extern int i; i=20; printf("%d",i); }
main() { int i=400,j=300; printf("%d..%d"); }
WAP to display 1,2,3,4,5........N
what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }
write a c-program to display the time using FOR loop
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql
What are segment and offset addresses?
main() { int i=10; i=!i>14; Printf ("i=%d",i); }