Question-Write a program to print all prime numbers from 1 to 300. (Hint: Use nested loops, break and continue)
Solution-
i have escaped problem called octal equivalent , since it's really basic stuff ,if you don't get it mail me. i din't solve the last problem because i couldn't make out, what's he saying ?
This one is a Good question. let's look up the solution.
#include<stdio.h>
int main()
{
int i,j;
for(i=0;i<=300;i++)
{
for(j=0;j<i;j++)
{
if (i%j==0)
break;
}
if(j==i)
printf("%d ",&i);
}
return 0;
}
Solution-
i have escaped problem called octal equivalent , since it's really basic stuff ,if you don't get it mail me. i din't solve the last problem because i couldn't make out, what's he saying ?
This one is a Good question. let's look up the solution.
#include<stdio.h>
int main()
{
int i,j;
for(i=0;i<=300;i++)
{
for(j=0;j<i;j++)
{
if (i%j==0)
break;
}
if(j==i)
printf("%d ",&i);
}
return 0;
}
No comments:
Post a Comment