Homework 8
Homework 8
Homework 8
CSE115
ID : 2421540642
Code:
#include <stdio.h>
void main()
{
int i,j,rows=5;
for(i=0; i<rows; i++)
{
for(j=0; j<i; j++ )
{
printf(" ");
}
for(j=0; j<rows; j++)
{
if(j==0 || j==rows-1-i || i==0)
{
printf("*");
}
else
{
printf(" ");
}
printf("\n");
}
Code:
#include <stdio.h>
void main()
{
int i,j,rows;
{
printf(" ");
}
{
char letter = 'A' + i;
Code:
#include <stdio.h>
void main()
{
int i,j,rows,num=1;
if(num > 9)
{
num = 0;
}
}
printf("\n");
}
Code:
#include <stdio.h>
void main()
{
int i,j,rows,num=1;
{
printf("%d", num);
num++;
if(num > 9)
{
num = 0;
}
}
printf("\n");
}
Code:
#include <stdio.h>
void main()
{
int i,j,k,rows;
printf(" ");
}
for(k=0; k<=i; k++)
{
printf("%d",(k%2));
printf("\n");
}
}
Code:
#include <stdio.h>
void main()
{
int i,j,k,rows;
printf(" ");
}
for(k=1; k<=(rows*2)-(2*i-1); k++)
{
printf("*");
}
printf("\n");
}
Code:
#include<stdio.h>
void main()
{
int i,j,k,rows;
for(i=1; i<=rows;i++)
{
printf("* ");
printf("\n");
}
printf("* ");
printf("\n");
}
}
Code:
#include<stdio.h>
void main()
{
int i,j,k,rows;
printf(" ");
}
for(k=1; k<=(2*i-1); k++)
{
printf("*");
printf("\n");
printf(" ");
}
printf("*");
printf("\n");