Skip to content

This repository includes many special program designed by using C programming language and basic level of data structures.

License

Notifications You must be signed in to change notification settings

saddeg21/Special-Programs-In-C

Repository files navigation

C_Logo

Special-Programs-In-C

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.

Included Programs

  • 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

Usage/Examples

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;
}

🔗 Links

linkedin

Feedback

If you have any feedback, please reach out to me at [email protected]

Authors

About

This repository includes many special program designed by using C programming language and basic level of data structures.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages