write the program for prime numbers?
Answer Posted / akhilesh singh(m.c.a-iisem ois
main()
{
int i,j=2,ch=0;
clrscr();
printf("\nENTER ANY NUMBER");
scanf("%d",&i);
while(j<=i/2)
{
if(i%j==0)
{
printf("%d IS NOT PRIME",i);
ch=1;
break;
}
else
{
j++;
}
}
if(ch==0)
{
printf("%d IS PRIME",i);
}
}
Is This Answer Correct ? | 1243 Yes | 384 No |
Post New Answer View All Answers
what are the advantages of a macro over a function?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
State the difference between x3 and x[3].
What is the difference between near, far and huge pointers?
What are void pointers in c?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Why c is known as a mother language?
What is a pointer value and address in c?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
Explain void pointer?
Why n++ execute faster than n+1 ?
What is a pointer and how it is initialized?