0% found this document useful (0 votes)
4 views6 pages

Bs Physics

The document contains six C programming assignments that involve printing different patterns of asterisks based on a specified integer value, n, which is set to 5. Each assignment features nested loops to create various shapes, including right-aligned triangles, left-aligned triangles, and inverted pyramids. The code snippets demonstrate basic control structures and output formatting in C.

Uploaded by

q809401
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

Bs Physics

The document contains six C programming assignments that involve printing different patterns of asterisks based on a specified integer value, n, which is set to 5. Each assignment features nested loops to create various shapes, including right-aligned triangles, left-aligned triangles, and inverted pyramids. The code snippets demonstrate basic control structures and output formatting in C.

Uploaded by

q809401
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Assignment No:03

Q1;
#include <stdio.h>

int main() {

int n = 5;

for (int i = 1; i <= n; i++) {

for (int j = 1; j <= n - i; j++) {

printf(" ");

for (int j = 1; j <= i; j++) {

printf("*");

printf("\n");

getchar();

return 0;

}
Q2;
#include <stdio.h>

int main() {

int n = 5;

for (int i = 1; i <= n; i++) {

for (int j = 1; j <= i; j++) {

printf("*");

printf("\n");

return 0;

}
Q3;
#include <stdio.h>

int main() {

int n = 5;

for (int i = 1; i <= n; i++) {

for (int j = 1; j <= n - i; j++) {

printf(" ");

for (int j = 1; j <= (2 * i - 1); j++) {

printf("*");

printf("\n");

return 0;

}
Q4;
#include <stdio.h>

int main() {

int n = 5;

for (int i = n; i >= 1; i--) {

for (int j = 1; j <= n - i; j++) {

printf(" ");

for (int j = 1; j <= i; j++) {

printf("*");

printf("\n");

return 0;

}
Q5;
#include <stdio.h>

int main() {

int n = 5;

for (int i = n; i >= 1; i--) {

for (int j = 1; j <= i; j++) {

printf("*");

printf("\n");

return 0;

}
Q6;
#include <stdio.h>

int main() {

int n = 5;

for (int i = n; i >= 1; i--) {

for (int j = 1; j <= n - i; j++) {

printf(" ");

for (int j = 1; j <= (2 * i - 1); j++) {

printf("*");

printf("\n");

return 0;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy