Assignment 4
Assignment 4
Source Code:
a.
#include <stdio.h>
return 0;
}
Output:
b.
#include <stdio.h>
printf("\n");
}
}
int main() {
int n = 4; // Number of rows for the pattern
printf("Pattern B:\n");
patternB(n);
return 0;
}
Output:
c.
#include <stdio.h>
int main() {
int n = 4; // Number of rows for the pattern
printf("Pattern B:\n");
patternB(n);
return 0;
}
Output:
Source Code:
#include <stdio.h>
int main() {
int n = 5; // Number of rows for the pattern
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
b. 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Source Code:
#include <stdio.h>
int main() {
int n = 5; // Number of rows for the pattern
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
c. 1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
5 4 3 2 1 2 3 4 5
Souce Code:
#include <stdio.h>
int main() {
int n = 5; // Number of rows for the pattern
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
Source Code:
#include <stdio.h>
int main() {
int n = 4; // Number of rows for the pattern
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
b. 0
1 1
2 3 5
8 13 21
Source Code:
#include <stdio.h>
int main() {
int n = 4; // Number of rows for the pattern
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
c. 1
121
12321
1234321
12321
121
1
Source Code:
#include <stdio.h>
int main() {
int n = 4; // Number of rows for the pattern
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
Source Code:
#include <stdio.h>
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
b. 1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Source Code:
#include <stdio.h>
int main() {
int n = 5; // Number of rows for the pattern
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
c. * * * *
* * *
* *
*
* *
* * *
* * * *
Source Code:
#include <stdio.h>
int main() {
int n = 4; // Number of rows for the pattern
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output:
d. 1 1
333 3 3 3
55555 5 5 5 5 5
7777777 7 7 7 7 7 7 7
55555 5 5 5 5 5
333 3 3 3
1 1
Source Code:
#include <stdio.h>
printf("Pattern A:\n");
patternA(n);
return 0;
}
Output: