This repository includes many special program designed by using C programming language and basic level of data structures.
It includes several programs which guides you to learn C language better and also use the benefits of language for calculation.
- Armstrong Number
- Binary to Decimal Converter
- Bitwise Addition
- Fibonacci Values
- Floyds Triangle
- Leap Year
- Palindrome Numbers
- Perfect Numbers
- Power of Integer
- Prime Number
- Pyramid of Stars
- Strong Number
- Sum Without Plus
A program to determine whether a number is PRIME or NOT
#include <stdio.h>
#include <math.h>
int main() {
int number,val1,val2;
printf("Enter a number which will be checked if it's prime: \n");
scanf("%d",&number);
val1=number;
val2=ceil(sqrt(number));
int count=0;
for(int i=2;i<=val2;i++) {
if(number%i==0) {
count=1;
}
}
if((count==0 && val1!=1) || val1==2) {
printf("%d is a prime number",val1);
} else {
printf("%d is NOT a prime number",val1);
}
return 0;
}
If you have any feedback, please reach out to me at ahmetdenizdastan@gmail.com