how to find the given number is prime or not?
Answer Posted / rajamanickam.m
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,flag=0,ctr;
printf("enter the number to be checked\n");
scanf("%d",&n);
for(ctr=2;ctr<=sqrt(n);ctr++)
{
if(n%ctr==0)
{
flag=1;
break;
}
}
if(flag==0)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
getch();
}
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What is 1d array in c?
how could explain about job profile
which type of aspect you want from the student.
The statement, int(*x[]) () what does in indicate?
C program to find all possible outcomes of a dice?
If you know then define #pragma?
What is hungarian notation? Is it worthwhile?
In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]
Which header file should you include if you are to develop a function which can accept variable number of arguments?
What’s the special use of UNIONS?
How many keywords (reserve words) are in c?
Explain setjmp()?
Under what circumstances does a name clash occur?
what is stack , heap ,code segment,and data segment
Differentiate between Macro and ordinary definition.