0% found this document useful (0 votes)
22 views

C Program

The document contains code snippets for calculating the factorial of a number, finding the area and circumference of a circle using a radius, and checking if a number is prime by checking for factors.

Uploaded by

Jerin K M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

C Program

The document contains code snippets for calculating the factorial of a number, finding the area and circumference of a circle using a radius, and checking if a number is prime by checking for factors.

Uploaded by

Jerin K M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include<iostream.

h>

#include<conio.h>

int main()

Int n;

Long fact = 1;

Clrscr();

Cout<< “\nFACTORIAL OF A NUMBER\n”;

Cout<< “\n-----------------------------------\n”;

Cout<< “\nEnter a Positive Number” ;

Cin>> n;

For(i=1;i<=n; i++)

Fact = fact * i;

Cout<< “\nFactorial of” <<n<< “=” <<fact;

Getch();

Return 0;

}
#include<iostream.h>
int main()
{
float r, area, circum;
cout<<"Enter the Radius of Circle: ";
cin>>r;
area = 3.14*r*r;
cout<<"\nArea of Circle = "<<area;
cout<<endl;
circum = 2*3.14*r;
cout<<"\nCircumference of Circle = "<<circum;
cout<<endl;
return 0;
}

#include <iostream.h> 
#include <conio.h> 

bool isPrime(int n)
{
      
    for (int i = 2; i < n; i++)
{
        
        if (n % i == 0)
            return false;
    }
    
    return true;
}
  
int main()
{
    int j;
clrscr();
      
    for (j = 10; j <= 100; j++)
{
        
        if (isPrime(j))
            cout << j << " ";
    }
  
     Getch();
return 0;
}

You might also like