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 |
#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.
6 Answers Fusion Systems GmbH,
What are segment and offset addresses?
plz send me all data structure related programs
write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).
0 Answers CDAC, College School Exams Tests,
programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h
Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];
4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }
How do you write a program which produces its own source code as its output?
main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }
{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }