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
How can I read data from data files with particular formats?
All technical questions
What is the difference between %d and %i?
What is the use of bit field?
1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if
Explain what is the difference between functions getch() and getche()?
Explain the advantages and disadvantages of macros.
Here is a good puzzle: how do you write a program which produces its own source code as output?
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
Can you please explain the scope of static variables?
Why functions are used in c?
How can you tell whether two strings are the same?
How can I insert or delete a line (or record) in the middle of a file?
about c language
What is the size of a union variable?