## Description

Hello Everyone..

Welcome to lapmos.com

Today we write a program in c , that how to calculate the given number is prime of not. Before start the code , we know about the prime number ( What is prime number ?)

Prime Number : Prime number is a number which divisible by 1 and own so we called the number is prime. The condition is number is greater than 1. or other words, A number is divisble by itself or 1 so called the prime number.

So now let's Start the code...

Logic 1

``````#include<stdio.h>

int main()
{
int n;
printf("Enter the number : ");
scanf("%d", &n);
int count = 0;
if(n==1){
count = 1;
}
for(int i=2; i<n; i++){
if(n%i==0){
count++;
}
}

if(count==0){
printf("%d is prime", n);
}
else{
printf("%d is not prime", n);
}
return 0;

}``````

Output :

Enter the number : 7
7 is prime

Logic 2

``````
#include<stdio.h>

int main()
{
int n;
printf("Enter the number : ");
scanf("%d", &n);
int count = 0;
int flag = 0;
if(n==1){
flag = 1;
}
for(int i=2; i<=n/2; i++){
if(n%i==0){
flag = 1;
}else{
count++;
}
}

if(flag==0){
printf("%d is prime", n);
}
else{
printf("%d is not prime", n);
}

return 0;
}
``````

Output :

Enter the number : 1
1 is not prime

## Largest Number | C programming language

Hello guys.. Today we write a program how to find the largest number ( greatest number ) in array c programming language.

## Swap two number | C programming

Write a c program swap two number given by user.

## Swap two number without using third variable | C programming language

Write a program Swap two number withtout using third variable in c programming language.

## Fibonacci Series | Fibonacci Series in C | @lapmos

Fibonacci numbers ( sequence ) is a set of numbers that start with 1 or 0 followed by a 1 proceeds on the rule that each number.

## Palindrome | Palindrome program in c | Palindrome Number

Write a program in c to check that the given number is palindrome or not?

## Pascal Triangle | C programming

pascal triangle program in c | Write a c program to print the pascal triangle.