How to write a C Program to accept n numbers & store all prime numbers in an array & display this result in C Programming Language ?
Solution:
/*C Program to accept n numbers & store all prime numbers in an array & display this result*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,n;
clrscr();
printf("\nEnter the n number: ");
scanf("%d",&n);
printf("\nEnter the numbers: ");
for(i=0;i<=n;i++)
{
scanf("%d",&a[i]);
}
printf("\nThe Prime Number is: ");
for(i=1;i<=n;i++)
{
if(a[i]%2==1)
{
printf("\t%d",a[i]);
}
}
getch();
}
//OUTPUT:
//Enter the n number: 4
//Enter the numbers: 1
//2
//3
//4
//5
//The Prime Number is: 3 5
Learn More :
Display
- DISPLAY SOURCE CODE AS OUTPUT IN C PROGRAM
- Sort Three Numbers - program reads in three Integers and displays them in ascending order.
- C Program To Display The Number In A Specific Formats
- C Program that Display a IBM Logo
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- LED ON OFF For One Sec/Count and Display on the Attached Serial Monitor
- Pre Order, Post order, In order Implement Binary Tree using linked list
- C Program to accept m*n matrix from user and display the elements of given matrix using function
- C program to display the transpose of given 3 X 3 matrix
- C Program to accept a string from user, delete all vowels from that string & display the result
- C Program To Create Two Singly Linked List and Perform Following Operation
- Create Two Singly Linked List Perform Differences Display It C Program
- C Program to Create, Display, Insert and Deletion of Queue Elements
- Creation and Display of Elements in Both Forward and Reverse Direction in a Doubly Linked List
- C Program to Display a real time clock (HH:MM:SS) on the LCD
- Program to Display Pie Chart Accepting User Input C Program
- Linked List For Getting Employee Details, Display and Search For Salary C Program
- Menu driven program in the creation,display,search, insertion and deletion of a node in the linked list
- Program to display the following pattern in C
- Display the Following Pattern * ** *** **** ***** C Program
Number
- Find out the perfect number using c program
- Write a c program to find out H.C.F. of two numbers.
- Check the given number is armstrong number or not using c program.
- Write a c program to find largest among three numbers using conditional operator
- FIND OUT GENERIC ROOT OF A NUMBER - C PROGRAM.
- FIND PRIME FACTORS OF A NUMBER USING C PROGRAM
- How To Write a C program that generates two random numbers ?
- Write a C program to find maximum or equal between two numbers ?
- How to Write a C program to find maximum between two numbers ?
- Write a C program to perform math operations on two input whole numbers. The operations are:
- Write a C program to find maximum between three numbers ?
- Sort Three Numbers - program reads in three Integers and displays them in ascending order.
- C Program to Enter an ODD number between 1 and 49.
- C program acquires keyboard 10 numbers for each of these numbers to determine if it is a first issue, by printing immediately message should at the end, if none of the numbers you entered was a first issue, print an appropriate message.
- C program generates a random number and uses an algorithm to generate 9 other numbers.
- C Program to Find Random Number
- C Program To Find LCM and HCF Of Two Number Using Function - 2
- C Program to find LCM and HCF Of Two Number Using Recursion - 3
- C Program To Find LCM and HCF Of Two Number -1
- C Program To Find Reverse Of Any Digit Number
- C Program To Find The Frequency Of A Number
- C Program To Print Prime Numbers Upto The Number You Want
- C Program To Print Sum Of n Digit Number
- C Program To Reverse A Number
- C Program To Search A Number Inside The Array
Result
- C Program to find result where value and power are user given
- C program that receives 10 float numbers from the console and sort them in non-ascending order, and prints the result
- C Program to calculate sum of two m*n matrices & store the result in 3 matrix
- C Program to accept a string from user, delete all vowels from that string & display the result
Prime Number
- PRINT PRIME NUMBERS BETWEEN 1-300 USING BREAK AND CONTINUE IN C
- Check given number is prime number or not using c program.
- C Program to Check Prime Use Loop And Recursive
- C or C++ program to print prime number
- C or C++ Program To Print Prime Number
- C Program For Prime Number or Not
- C Program For Prime Number Using Function
- C Program For Prime Number
- Huge Prime in C Program
- C Program to Detection of a Prime Number
- C Program to print all prime numbers from 1 to 300.
- C Program To Find Prime Number And If Number Is Not Prime Then Find Factors
- C Program to Find Prime Number and Complex Number
n
- C Program to Sum of The First and Last Digit Of 'n' Digit Number
- A small I/O bound program to copy N bytes from an input file to an output file.
- C Program to Calculate the mathematical expression for the first n numbers
- C Program to accept n numbers from user & find out the maximum element out of them by using dynamic memory allocation
- C Program to accept n numbers from user store these numbers into an array & calculate average of n numbers
- C Program to accept n numbers from user store these numbers into an array & reverse an array elements using function
- C Program to accept n numbers from user,store these numbers into an array & sort the number of an array
- Accept n number from user, store these number into an array and calculate the average of n number
Accept
- C Program to accept n numbers from user & find out the maximum element out of them by using dynamic memory allocation
- C Program to accept string from user & convert all lower case letters into upper case letters & vice versa
- C Program to accept m*n matrix from user and display the elements of given matrix using function
- C Program to accept n numbers from user store these numbers into an array & calculate average of n numbers
- C program to accept n number from user,store these numbers into an array & count the no of occurrences of each number
- C Program to accept n numbers from user store these numbers into an array & reverse an array elements using function
- C Program to accept a string from user, delete all vowels from that string & display the result
- Write a c program to accept a string from user & generate following pattern (e.g, input "abcd")
- C Program to accept 5 names from user & store these names into an array. Sort these array elements in alphabetical order
- C Program to accept n numbers from user,store these numbers into an array & sort the number of an array
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array
- C Program to accept data from user store that data into text file
- Accept n number from user, store these number into an array and calculate the average of n number
Store
- C Program To Store Students Record In A Text File
- C Program To Store Students Record Using Structure
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- C Program to calculate sum of two m*n matrices & store the result in 3 matrix
- C Program to accept n numbers from user store these numbers into an array & calculate average of n numbers
- C program to accept n number from user,store these numbers into an array & count the no of occurrences of each number
- C Program to accept n numbers from user store these numbers into an array & reverse an array elements using function
- C Program to accept 5 names from user & store these names into an array. Sort these array elements in alphabetical order
- C Program to accept n numbers from user,store these numbers into an array & sort the number of an array
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array
- C Program to accept data from user store that data into text file
- Find the union and intersection of two sets of integer store it in two array C Program
- Accept n number from user, store these number into an array and calculate the average of n number
- C Program - Hash Table to store information about a student
- C Program to Input Student Details into a File For Two Subjects
Array
- How to pass one dimensional array to function in c.
- Write a c program which passes two dimension array to function.
- C Program Array Index Example
- C Program Array Example: Average
- C Program Array Example: Reverse
- C Program Array Example
- C Program to Array
- C Program Array NxM Elements Geometric/Arithmetic
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Union & Intersection Of Two Array
- C Program To Search A Number Inside The Array
- C Program To Sort An Array In Ascending And Descending Order
- C Program To Sort An Array Of Names In Alphabetical And Reverse Order
- C Program To Copy One Character Array Into Another
- Returns: array of decoded values. [0] - count of values
- C Program to Check if a number is in an array[1000]
- C Program to Find max and min in array using pointer concept
- C Program Sort Array By Segment
- C Program to sort an array using bubble sort
- C Program to find smallest in an array using pointer
- C Program to merge and sort two arrays
- Un-sortiertes Array and Sortiertes Array
- C Program to Array Deserialization
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- Input reads in the array positions and range for random generation.