0% found this document useful (0 votes)
28 views4 pages

Practical 8

Uploaded by

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

Practical 8

Uploaded by

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

NIL GADHIYA Practical 8 23SE02IE068

Aim 1 : Write a program to print 1 to 10 using loop.

Input :

#include <stdio.h>

int main() {

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

printf("%d ", i);

printf("\n");

return 0;

Output :
NIL GADHIYA Practical 8 23SE02IE068

Aim 2 : Write a program to print even number with the range between 1 to
100.

Input :

#include <stdio.h>

int main() {

printf("Even numbers between 1 to 100:\n");

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

if (i % 2 == 0) {

printf("%d ", i);

printf("\n");

return 0;

Output :
NIL GADHIYA Practical 8 23SE02IE068

Aim 3 : Write a program to print following pattern for a user-defined


number.

e.g. N=5

* *

* * *

* * * *

* * * * *

Input :

#include <stdio.h>

int main() {

int N;

printf("Enter the value of N: ");

scanf("%d", &N);

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

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

printf("* ");

printf("\n");

return 0;

}
NIL GADHIYA Practical 8 23SE02IE068

Output :

You might also like