Let Us C Solution

 PROBLEM 6.1

Write  a program to print all prime numbers from 1 to 300. */
#include<stdio.h>
int main()
{
	int i,n=1;
	printf("\nPrime numbers between 1 and 300 are:\n\t");
	for(n=1;n<=300;n++)
	{
		i=2;
		for(i=2;i<n;i++)
		{
			if(n%i==0)
			break;
		}
		if(i==n)
		printf("%d\t",n);
	}
	return 0;
}
Welcome to prgrmramit.blogspot.com! I'm Amit Singh, an expert in AI, Data Science, and Machine Learning. I created this blog to share practical insights and tips for those eager to learn and gro…

Post a Comment

Subscribe with Gmail


Premium By Raushan Design