Write a program to print prime nums from 1-20 using c
programing?

Answer Posted / aniruddha tripathi

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,m,i;
clrscr();
printf("\n ENTER THE NUMBER");
scanf("%d",&n);
i=2;
ab:mfmod(n,i);
if(m==0);
{
printf("\n it is not prime");
goto bc;
]
else
{
i=i+1;
if(i<=(n-1))
{
goto ab;
}
printf("\n it is a prime no.");
}
bc;
getch();
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is static memory allocation? Explain

819


How can you return multiple values from a function?

832


What is the best way of making my program efficient?

760


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1086


How can a number be converted to a string?

897


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

877


What are terms in math?

790


What is the use of typedef in structure in c?

711


Do you know the purpose of 'register' keyword?

812


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2298


What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25

1700


What is a macro?

864


How will you delete a node in DLL?

936


Differentiate between new and malloc(), delete and free() ?

899


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

899