Write a program that allows you to enter an integer N and display the triangle of stars. for example N = 4
*
***
*****
*******
******** In Algorithm ********
Algorithm Variables i,j,N : integers Begin write("Enter an integer : ") read (N) for i from 0 to N-1 for j from 1 to (N*2)-1 if (j >= N-i and j <= N+i ) then write("*") else write(" ") next next write("\n") next End Result ==> Enter an integer : 4 * *** ***** *******
******** In C ********
#include<stdio.h> int main() { int i,j,N; printf("Enter an integer : "); scanf("%d",&N); for(i=0;i<N;i++){ for(j=1;j<=(N*2)-1;j++){ if (j>=N-i && j<= N+i ) printf("*"); else printf(" "); } printf("\n"); } return 0 ; }
******** In C++ ********