Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 8448811320
Home › Community › WAC to print all prime numbers between 1 and 100

WAC to print all prime numbers between 1 and 100

Soham  •  Jul 17, 2026  •  47 views
0

2 Answers

Soham
Jul 17, 2026
#include <stdio.h>

int main()
{
int i, j, count;

for(i = 2; i <= 100; i++)
{
count = 0;

for(j = 1; j <= i; j++)
{
if(i % j == 0)
count++;
}

if(count == 2)
printf("%d ", i);
}

return 0;
}
Soham
Jul 17, 2026
#include <stdio.h>

int main()
{
int i, j, count;

for(i = 2; i <= 100; i++)
{
count = 0;

for(j = 1; j <= i; j++)
{
if(i % j == 0)
count++;
}

if(count == 2)
printf("%d ", i);
}

return 0;
}

Your Answer

Will not be displayed publicly
Talk to Advisor Online now
1