-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.cpp
45 lines (45 loc) · 823 Bytes
/
demo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
using namespace std;
//**************************
//**************************
bool is_Leapyear(int year)
{
if(year%400==0||(year%4==0&&year%400!=0)||(year % 3200 == 0 && year % 172800 == 0))
{
return true;
}
return false;
}
bool is_Squarenumber(int number)
{
for(int i=1;i<number;i++)
{
if(i*i==number)
{
return true;
}
}
return false;
}
long long Factorial(int number)
{
int result=0;
for(int i=1;i<=number;i++)
{
int temp=1;
for(int j=1;j<=i;j++)
{
temp*=j;
}
result+=temp;
}
return result;
}
int main()
{
cout<<is_Prime(37)<<endl;
cout<<is_Leapyear(2008)<<endl;
cout<<is_Squarenumber(5)<<endl;
cout<<Factorial(5)<<endl;
return 0;
}