Professional Documents
Culture Documents
It Lab 6...
It Lab 6...
Step 1 – START
Step 4 – execute 1st loop , put a condition i<=rows and updating i++.
Step 5 — execute 2nd loop , put a condition j<=i and updating j++.
Step 8—STOP.
FLOWCHART:-
START
print new
line(\n).
STOP.
Source code :--
#include <stdio.h>
int main ()
{
int rows;
printf("how many rows do want in this shape \n");
scanf("%d",&rows);
starpattern(rows);
return 0;
}
OUTPUT:-
(B) For ISOSCELES TRIANGLE:
Sol. Algorithm:-
Step 1 – START
Step 4 – execute 1st loop , put a condition i<=rows and updating i++.
Step 5 — execute 2nd loop , put a condition j<=rows and updating j++.
Step 7— execute 3rd loop, put condition j<=((2*i)-1) and updating ++j.
Step 10—STOP.
FLOWCHART:-
START
Declare integer i, j and rows.
#include <stdio.h>
void starpattern(int rows)
{
int i,j;
for (i=1; i<=rows; i++)
{
for (j=i; j<=rows; ++j)
{
printf(" ");
}
Sol. Algorithm:-
Step 1 – START
Step 4 – execute 1st loop, i=1 and put condition i<=12, updating i++.
Step 7—STOP.
START
FLOWCHART:-
Exit loop.
STOP.
Source code :--
#include <stdio.h>
int main()
{
int x=0,y=1,i,z;
printf("x=%d\ty=%d\n",x,y);
printf("Print Fibonacci series up to 100:-\n");
for(i=1;i<=12;i++)
{
printf("%d\n",x);
z=x+y;
x=y;
y=z;
}
return 0;
}
OUTPUT:-