write the program for prime numbers?
Answer Posted / gnanasekaran
int main()
{
int i,j,n,f=0;
printf("Enter the length\n");
scanf("%d",&n);
for(i=2;i<=n/2;i++)
{
for(j=2;j<i;j++)
{
if((i%j)==0)
{
f=1;
break;
}
f=0;
}
if(f==0)
printf("%d ",i);
}
}
Is This Answer Correct ? | 139 Yes | 81 No |
Post New Answer View All Answers
What is typeof in c?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
What are derived data types in c?
will u please send me the placement papers to my mail???????????????????
What is strcpy() function?
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?
Is there any possibility to create customized header file with c programming language?
Can you tell me how to check whether a linked list is circular?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What is a c token and types of c tokens?
What is #include stdio h and #include conio h?
What are the different types of control structures?
What is C language ?