PC IEEE Format
PC IEEE Format
Batch 16
Vignan University
Vadlamudi, Guntur, Andhra Pradesh
ALGORITHM:
B) As a part of a school assignment on fractals, you need to
Step 1: Start generate a Pascal's triangle. The triangle should demonstrate
Step 2: Read h the mathematical properties of binomial coefficients.
Step 3: Initialize i =1, j=1 Requirements:
Step 4: Check i <=h The program should prompt the user to enter the number of
True, go to step 5, i++ rows for Pascal’s triangle.
False go to step 6 Generate and display Pascal's triangle pattern.
Step 5: Check j <= i Example: Number of rows for Pascal's triangle: 5
print * 1
j++, go to step 4 11
Step 6: Stop 121
1331
FLOWCHART: 14641
ALGORITHM:
Step 1: Start
Step 2: Read the number of rows rows from the user.
Step 3: Initialize i = 0.
Step 4: Check if i < rows:
- True: Go to Step 5
- False: Go to Step 9
Step 5: Initialize value = 1 Step 6: Initialize j = 0.
Step 7: Check if j <= i:
True: Print value, Update value using the formula:
value = value * (i - j) / (j + 1)
Increment j++ and go back to Step 7. -
False: Go to Step 8.
Step 8: Print a newline character \n after the current row is
printed.
Increment i++ and go back to Step 4.
Step 9: Stop.
Step 1: Start
Step 2: Read size (the dimensions of the square pattern).
Step 3: Initialize i = 0.
Step 4: Check if i < size:
- True: Go to Step 5
- False: Go to Step 11
Step 5: Initialize j = 0.
Step 6: Check if j < size:
- True: Go to Step 7
- False: Go to Step 10
Step 7: Calculate the layer value:
- Set layer = (i < j ? i : j) (smallest of i or j).
- Update layer = (layer < size - i ? layer : size - i
- 1) (smallest between current layer and size - i - 1).
- Update layer = (layer < size - j ? layer : size - j
- 1) (smallest between current layer and size - j - 1).
Step 8: Check if layer % 2 == 0:
- True: Print *
- False: Print a space " "
Step 9: Increment j++, go back to Step 6
Step 10: Print a newline character (\n) after completing one
PROGRAM:
row.
Increment i++ and go back to Step 4.
#include <stdio.h>
Step 11: Stop.
int main() {
int rows, i, j, value;
FLOWCHART:
scanf("%d", &rows);
for (i = 0; i < rows; i++) {
value = 1;
for (j = 0; j <= i; j++) {
printf("%d ", value);
value = value * (i - j) / (j + 1);
}
printf("\n");
}
return 0;
}
*******
* *
* *** *
* * * *
* *** *
* *
*******
PROGRAM: Step 10: Print a newline character (\n) after completing one
row.
#include <stdio.h> Step 11: Increment i++ and go back to Step 4.
int main() { Step 12: Stop.
int size,i,j,layer;
scanf("%d",&size); FLOWCHART
for(i=0;i<size;i++){
for(j=0;j<size;j++){
layer=(i<j?i:j);
layer=(layer<size-i?layer:size-i-1);
layer=(layer<size-j?layer:size-j-1);
if(layer%2==0)
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
D) You are asked with creating an interactive art installation
that involves a dynamic and complex pattern display the
pattern chosen is a wave matrix, which should be displayed
in a wave-like fashion based on user input
Requirements:
The program should prompt the user to enter the size of the
wave pattern generate and display the wave pattern