write the program for prime numbers?
Answer Posted / sikendar kumar
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,count=0;
clrscr();
printf("enter a no.");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count==1)
{
printf("not prime no.");
}
else
printf("prime");
return 0;
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Write a program to identify if a given binary tree is balanced or not.
Explain do array subscripts always start with zero?
what are the advantages of a macro over a function?
What is the use of gets and puts?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
How to create struct variables?
Why do we write return 0 in c?
Are pointers integer?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
Why & is used in scanf in c?
I came across some code that puts a (void) cast before each call to printf. Why?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor