Showing posts with label s. Show all posts
Showing posts with label s. Show all posts

Wednesday, February 18, 2015

C program to produce the folowing design using s


#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,n;
char ch=A;
clrscr(); //to clear the screen
printf("How many lines?");
scanf("%d",&n);

for(i=0;i<n;++i)
{
for(j=0;j<=i;++j)
printf("%c",ch+j);
printf("
");

}
getch();     //to stop the screen
}
Read more »

Wednesday, February 11, 2015

C program to produce the following design using s



#include<stdio.h>
#include<conio.h>

void main()
{
int i,j,k,n;
clrscr(); //to clear the screen
printf("How many lines:");
scanf("%d",&n);
n*=2;
printf("
");


for(i=1;i<n;i+=2)
{
for(j=n-1;j>i;j-=2)
printf(" ");
for(k=1;k<=i;++k)
{
if(i==n-1)
printf("*");
else
if(k==1||k==i)
printf("*");
else
printf(" ");
}
printf("
");

}
getch(); //to stop the screen;
}
Read more »