write the program for prime numbers?
Answer Posted / vinay tiwari
try this u can find out all prime number between 2 and any
number entered by user .i write code in c# language but
concept remain same in any language.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication23
{
class Program
{
static void Main(string[] args)
{
int i=2, j, rem;
while (i <= 100)
{
for (j = 2; j < i; j++)
{
rem = i % j;
if (rem == 0)
break;
}
if (i == j)
Console.WriteLine(i);
i++;
}
}
}
}
Is This Answer Correct ? | 250 Yes | 136 No |
Post New Answer View All Answers
I came across some code that puts a (void) cast before each call to printf. Why?
How are pointers declared in c?
What is optimization in c?
what is recursion in C
What are the primitive data types in c?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
What is a far pointer in c?
What is a list in c?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
Is it fine to write void main () or main () in c?
What is the purpose of macro in C language?
What are the ways to a null pointer can use in c programming language?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year