Name: Class Roll No: 5 6 Section: G Date: 12.11.2020 Assignment No: 7
Name: Class Roll No: 5 6 Section: G Date: 12.11.2020 Assignment No: 7
Name: Class Roll No: 5 6 Section: G Date: 12.11.2020 Assignment No: 7
Class Roll No : 5 6
Section : G
Date : 12.11.2020
Assignment No : 7
Q1.
Ans :
#include <stdio.h>
int main() {
int i, j, n;
printf("\n");
}
return 0;
}
Output:
Q2.
Ans:
#include <stdio.h>
int main() {
int i, j, n;
printf("\n");
}
return 0;
}
Output:
Q3.
Ans:
#include <stdio.h>
int main() {
int i, j, n;
printf("Enter the number of rows : ");
scanf("%d", &n);
return 0;
}
Output:
Q4.
Ans :
#include <stdio.h>
int main() {
int i, j, n;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
return 0;
}
Output:
Q5.
#include <stdio.h>
int main() {
int i, j, n;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
return 0;
}
Output:
Q6.
#include <stdio.h>
int main() {
int i, j, n;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
return 0;
}
Output:
Q7.
#include <stdio.h>
int main() {
int i, j, k, n;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
return 0;
}
Output:
Q8.
#include <stdio.h>
int main() {
counter1 = 0;
counter2 = 0;
k = 0;
printf("\n");
}
return 0;
}
Output:
Q9.
#include <stdio.h>
int main() {
int n;
printf("Enter the number of rows : ");
scanf("%d", &n);
int i, j;
for(i = n; i >= 1; i--) {
for(j = 0; j < n - i; j++) {
printf(" ");
}
printf("\n");
}
return 0;
}
Output:
Q10.
#include <stdio.h>
int main() {
int n;
printf("Enter the number of rows : ");
scanf("%d", &n);
int c = 1, i, j, k;
printf("\n");
}
return 0;
}
Output:
Q11.
#include <stdio.h>
int main() {
int i, j, n, counter = 1;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
return 0;
}
Output:
Q12.
#include <stdio.h>
int main() {
int i, j, n, counter = 1;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
counter -= 2;
printf("\n");
}
return 0;
}
Output:
Q13.
#include <stdio.h>
int main() {
int i, j, n, counter = 1;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
return 0;
}
Output:
Q14.
#include <stdio.h>
int main() {
int i, j, n, counter = 1;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
return 0;
}
Output:
Q15.
#include <stdio.h>
int main() {
int i, j, n;
printf("Enter the number of rows : ");
scanf("%d", &n);
if(i == 1 || i == n) {
for(j = 1; j <= n; j++) {
printf("*");
}
} else {
printf("*");
for(j = 1; j <= n - 2; j++) {
printf(" ");
}
printf("*");
}
printf("\n");
}
return 0;
}
Output:
Q16.
#include <stdio.h>
int main() {
int i, j, n;
printf("Enter the number of rows : ");
scanf("%d", &n);
printf("\n");
}
return 0;
}
Output:
Q17.
#include <stdio.h>
int main() {
int i, j, n;
printf("Enter the number of rows : ");
scanf("%d", &n);
if(i == 1 || i == n) {
for(j = 1; j <= n; j++) {
printf("*");
}
} else {
printf("*");
for(j = 1; j <= n - 2; j++) {
printf(" ");
}
printf("*");
}
printf("\n");
}
return 0;
}
Output: