Print The Following Pattern
Program in C:
#include <stdio.h>
int main()
{
for(int i=1;i<=5;i++)
{
for(int j=5;j>i;j--)
printf(" ");
for(int l=1;l<2*i;l++)
printf("*");
printf("\n");
}
return 0;
}
Program in JAVA:
public class Pattern
{
public static void main(String[] args)
{
for(int i=1;i<=5;i++)
{
for(int j=5;j>i;j--)
System.out.print(" ");
for(int l=1;l<2*i;l++)
System.out.print("*");
System.out.println();
}
}
}
Program in C:
#include <stdio.h>
int main()
{
for(int i=1;i<=5;i++)
{
for(int j=5;j>i;j--)
printf(" ");
for(int l=1;l<2*i;l++)
printf("*");
printf("\n");
}
return 0;
}
Program in JAVA:
public class Pattern
{
public static void main(String[] args)
{
for(int i=1;i<=5;i++)
{
for(int j=5;j>i;j--)
System.out.print(" ");
for(int l=1;l<2*i;l++)
System.out.print("*");
System.out.println();
}
}
}
No comments:
Post a Comment