Assigment 6 Nested Loops
Assigment 6 Nested Loops
getch();
}
#include <stdio.h>
#include<conio.h>
int main() {
int n, i, j, num = 1;
Clrscr();
// Input the number of lines
printf("Enter the number of lines: ");
scanf("%d", &n);
// Outer loop for each row
for(i = 1; i <= n; i++) {
// Inner loop for printing numbers in each row
for(j = 1; j <= i; j++) {
printf("%d ", num);
num++;
}
// Move to the next line after each row
printf("\n");
}
getch();
}
ABC
DE
#include <stdio.h>
#include<conio.h>
int main() {
int n,i,j;
char ch = 'A';
Clrscr();
printf("Enter the number of lines: ");
scanf("%d", &n);
getch();;
}
4) Write a program to generate following pattern.
5
45
345
2345
12345
#include <stdio.h>
#include<conio.h>
int main() {
int n, i, j;
getch();
}
5) Write a program to generate following pattern.
Aa
Aa Bb
Aa Bb Cc
Aa Bb Cc Dd
#include <stdio.h>
#include<conio.h>
int main() {
int n, i, j;
char ch_upper, ch_lower;
getch();
}
6) Write a program to accept two numbers as range and display
multiplication table of all numbers within that range.
#include <stdio.h>
#include<conio.h>
int main() {
int start, end, i, j;
Clrscr();
// Input the range of numbers
printf("Enter the start of the range: ");
scanf("%d", &start);
printf("Enter the end of the range: ");
scanf("%d", &end);
getch();
}
7) Write a program to display all Armstrong between 1 and
1000
#include <stdio.h>
#include<conio.h>
int main() {
int num, originalNum, remainder, arm=0;
Clrscr();
// Loop through numbers from 1 to 1000
for(num = 1; num <= 1000; num++) {
originalNum = num;
Getch() ;
}
#include <stdio.h>
#include<conio.h>
int main() {
int num, sum=0, digit;
Clrscr();
// Input the number
printf("Enter a number: ");
scanf("%d", &num);
Getch();
}