class primenoSeries
{
void main ()
{
int i = 1; // Used to divide number and check if they are factors or not.
int C = 0; // used as a counter for number of factors.
int n = 1; // Represent the numbers.
while (n > 0)
{
if ( n % i n )
{
C = 0;
n++ ;
i = 1;
}// Check next number since previous number had more than two factors.
else
{
i++ ;
}
}
else
i++ ;
}
}
}
fdsgfhgdfhgdf
By learning how to program on C+.
# include<stdio.h> main() { int a,b,c; print f("enter the values of a,b,c"); scan f("%d%d%d",&a,&b,&c); if((a>b)&&(a>c)) print f("Greatest value is a =%d",a); else if((b>a)&&(b>c)) print f("Greatest value is b=%d",b); else print f("Greatest value is c=%d",c); }
#include #includevoid main() int prime(int num) { inti,flag; for(i=2;i
The answer depends on what value C has.
#include
fdsgfhgdfhgdf
By learning how to program on C+.
// simple program to generate first ten prime numbers #include<stdio.h> #include<conio.h> void main() { int c,i,j,n; clrscr(); for(i=2;i<30;i++) { c=0; for(j=2;j<i;j++) { if(i%j==0) {c=c+1; } } if(c==0) printf("%d",i); } getch(); }
Since there is an infinite set of prime numbers the answer would be infinity.
10 input "enter a no."; n 20 for i = 1 to n 30 if n mod i = 0 then c = c +1 40 next i 50 if c = 2 then print "prime number" else print "not a prime number" 60 end
This is a homework question and does not deserve an answer because you will learn nothing other than being lazy.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
Write a c program to print the 100 to 1 nos
/*the program to print prime no from 1 to 300*/ #include<stdio.h> #include<conio.h> void main() { int i,j; clrscr(); printf("The prime numbers from 1 to 300 are\n"); for(j=2;j<=300;j++) { for(i=2;i<=j/2;i++) if(j%i==0) break; if(i>j/2) { printf("%d ",j); } } }
To get all tutorials of "c programming" Reference:cprogramming-bd.com/c_page2.aspx# prime number
how do we use loops in c plus plus programing and what are basic differences between do,for and while loop