[go: up one dir, main page]

0% found this document useful (0 votes)
13 views2 pages

PF Lab6 Nested Loops EngUrdu

The document provides two C programming examples using nested loops: one for printing a triangle number pattern and another for displaying multiplication tables from 1 to 10. Each program includes explanations in both English and Urdu, as well as the corresponding code and expected output. The first program prints numbers in a triangular format, while the second generates multiplication results for numbers 1 through 10.

Uploaded by

laibaziauallah01
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)
13 views2 pages

PF Lab6 Nested Loops EngUrdu

The document provides two C programming examples using nested loops: one for printing a triangle number pattern and another for displaying multiplication tables from 1 to 10. Each program includes explanations in both English and Urdu, as well as the corresponding code and expected output. The first program prints numbers in a triangular format, while the second generates multiplication results for numbers 1 through 10.

Uploaded by

laibaziauallah01
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/ 2

PF Lab 6 - Nested Loops in C (English +

Urdu Explanation)
Program 1: Number Pattern Using Nested For Loop

Explanation (English)
This program prints a triangle pattern using nested for loops. The outer loop runs for each row
and the inner loop prints numbers from 1 to the current row number.

Explanation (Urdu)
Yeh program nested for loops ka use karke ek number triangle pattern print karta hai. Har outer
loop row ke liye chalta hai aur inner loop us row mein 1 se le kar us number tak values print
karta hai.

Code
#include <stdio.h>
int main() {
int i, j;
for (i = 1; i <= 5; i++) {
for (j = 1; j <= i; j++) {
printf("%d ", j);
}
printf("\n");
}
return 0;
}

Expected Output
1
12
123
1234
12345
Program 2: Multiplication Table Using Nested Loops

Explanation (English)
This program uses nested loops to display multiplication tables from 1 to 10. Each row shows
the multiples of a number.

Explanation (Urdu)
Yeh program nested loops ka use karta hai taake 1 se 10 tak ke multiplication tables print kiye ja
saken.

Code
#include <stdio.h>
int main() {
int i, j;
for (i = 1; i <= 10; i++) {
for (j = 1; j <= 10; j++) {
printf("%d x %d = %d\n", i, j, i*j);
}
printf("\n");
}
return 0;
}

You might also like