write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)

Answer Posted / nikhil

#include<stdio.h>
#include<conio.h>
void main()
{
int m,flag;
flag=0;
for(int i=2;i<100;i++)
{
for(int j=1;j<i;j++)
{
if(i%j==0)
{flag++;
}
}
if(flag==2)
{printf("it is prime %d",i);
}

}
getch();
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you delete a node in DLL?

700


How do I send escape sequences to control a terminal or other device?

626


In a switch statement, explain what will happen if a break statement is omitted?

651


Is c procedural or object oriented?

597


Describe the modifier in c?

622






Explain a file operation in C with an example.

677


Explain how do you convert strings to numbers in c?

606


Are the variables argc and argv are local to main?

805


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

4856


how many errors in c explain deply

1645


Who developed c language?

654


Was 2000 a leap year?

646


Why pointers are used in c?

602


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1546


Write a C program linear.c that creates a sequence of processes with a given length. By sequence it is meant that each created process has exactly one child. Let's look at some example outputs for the program. Here the entire process sequence consists of process 18181: Sara@dell:~/OSSS$ ./linear 1 Creating process sequence of length 1. 18181 begins the sequence. An example for a sequence of length three: Sara@dell:~/OSSS$ ./linear 3 Creating process sequence of length 3. 18233 begins the sequence. 18234 is child of 18233 18235 is child of 18234 ........ this is coad .... BUt i could not compleate it .....:( #include #include #include #include int main(int argc, char *argv[]) { int N; pid_t pid; int cont; if (argc != 2) { printf("Wrong number of command-line parameters!\n"); return 1; } N = atoi(argv[1]); printf("Creating process sequence of length %d.\n",N); printf("%d begins the sequence.\n",getpid()); /* What I have to do next ?????? */ }

1635