write the program for prime numbers?

Answer Posted / adhiyamaan

#include<stdio.h>
#include<conio.h>
{
int num,i;
printf("enter the number:");
scanf("%d",&num);
for(i=2;i<=num-1;i++)
{
if(num%i==0)
{
printf("NOT PRIME");
break;
}
}
if(i==num)
{
printf("PRIME");
}
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

3984


How can a number be converted to a string?

611


Explain what are run-time errors?

612


Why do some versions of toupper act strangely if given an upper-case letter?

636


How can you increase the size of a dynamically allocated array?

647






What is array of structure in c?

603


How a string is stored in c?

592


What is merge sort in c?

649


When should the const modifier be used?

660


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1316


Do pointers take up memory?

662


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

1601


What are types of structure?

608


What is the acronym for ansi?

633


Why is C language being considered a middle level language?

658