C Program To Print Odd Numbers Between 1 To 100
In this article, we are going to write a c program to print odd numbers between 1 to 100
We will make this program in the following way -:
- C Program To Print Odd Numbers Between 1 To 100
- C Program To Print Odd Numbers Between 1 To N
- C Program To Print Odd Numbers Between 1 To 100 Using Function
To make this program, we will use the following concept given below. If you do not know about these topics well, then you may not understand this program, so you should know about them in detail from the link given below.
Now without wasting time let’s start programming.
C Program To Print Odd Numbers Between 1 To 100
Algorithm
- Program Start
- Declare Variable
- check condition
- print result according to condition
- Program End
Program
//C Program To Print Odd Numbers Between 1 To 100 Using For Loop
#include<stdio.h>
void main()
{
int i;
for(i=1;i<=100;i++)
{
if(i%2!=0)
{
printf("%d \n",i);
}
}
}
Output
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
C Program To Print Odd Numbers Between 1 To N
Program
//C Program To Print Odd Numbers Between 1 To N
#include<stdio.h>
void main()
{
int i,n;
printf("Enter how many number you want \n");
scanf("%d",&n);
printf("Odd Numbers Between 1 to %d : \n",n);
for(i=1;i<=n;i++)
{
if(i%2!=0)
{
printf("%d \n",i);
}
}
}
Output
Enter how many number you want
10
Odd Numbers Between 1 to 10 :
1
3
5
7
9
C Program To Print Odd Numbers Between 1 To 100 Using Function
Algorithm
- Program Start
- Declare Variable
- Calling Function
- check condition
- print result according to condition
- Program End
Program
//<span style="font-size: inherit;">C Program To Print Odd Numbers Between 1 To 100 Using Function</span>
#include<stdio.h>
int main()
{
//Calling Funcrion
oddnumbers();
return 0;
}
void oddnumbers()
{ int i;
printf("Odd Numbers Between 1 to 100 : \n");
for(i=1;i<=100;i++)
{
if(i%2!=0)
{
printf("%d \n",i);
}
}
}
Output
Odd Numbers Between 1 to 100 :
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
Read More
- Download C Language Notes Pdf
- C Language Tutorial For Beginners
- C Programming Examples With Output
- 250+ C Programs for Practice PDF Free Download
Conclusion
So friends, in this article, we have written a c program to print odd numbers between 1 to 100 in three different ways.
- C Program To Print Odd Numbers Between 1 To 100
- C Program To Print Odd Numbers Between 1 To N
- C Program To Print Odd Numbers Between 1 To 100 Using Function
If you have difficulty to understanding any program or have any doubts or questions, then tell me in the comment below.