Skip to content

Instantly share code, notes, and snippets.

View thecoducer's full-sized avatar
🐳
learning & unlearning

Mayukh Datta thecoducer

🐳
learning & unlearning
View GitHub Profile
int digitsInFactorial(int N)
{
double digits = 0;
if(N<=1){ return N; }
for(int i=2;i<=N;i++){
digits += log10(i);
}
return floor(digits) + 1;
}
#include<iostream>
#include <cmath>
using namespace std;
double findAngle(double h, double m){
double angle;
//corner cases
if(h == 12)
h=0;
if(m == 60)
m=0;
#include<bits/stdc++.h>
using namespace std;
typedef struct{
int x, y;
}Point;
bool isSquare(Point p1, Point p2, Point p3, Point p4);
int dist(Point m, Point n);
#include<bits/stdc++.h>
using namespace std;
long long fibo(int n)
{
long long f[n+1];
f[0] = 0; f[1] = 1;
for(int i=2;i<=n;i++){
f[i] = f[i-2] + f[i-1];
}
#include<bits/stdc++.h>
using namespace std;
#define NIL -1
#define MAX 1000
long long lookup[MAX];
void fill()
{
memset(lookup, NIL, MAX * sizeof(lookup[0]));
@thecoducer
thecoducer / revision.java
Created June 30, 2019 21:43 — forked from danielpaul/revision.java
Basic Java Revision Notes - Written in Java
/*
*
* / --------------------------------[ NUIM CS141 Java Revision ]------------------------------- \
* || Designed to easily revise everything covered in CS141 by just reading through this code. ||
* || Comments accompany almost every line of code to explain its purpose. ||
* || Some theory we need to know are included in the bottom... ||
* \ ------------------------------------------------------------------------------------------- /
*
*
* ____ _ __ ____ __
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
void SieveOfEratosthenes(int n);
int main(void){
int n;
cout<<"Enter the value of n: ";
cin>>n;
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
void SieveOfEratosthenes(int n);
int main(void){
int n;
cout<<"Enter the value of n: ";
cin>>n;
#include<stdio.h>
#include<stdbool.h>
#include<math.h>
bool isPrime(long n);
int main(void){
long n;
printf("Enter the number for primality test: ");
scanf("%ld", &n);
printf("Result: %s\n", isPrime(n)?"Is a Prime.":"Not a Prime.");
#include<stdio.h>
#include<stdbool.h>
bool isPrime(long n);
int main(void){
long n;
printf("Enter the number for primality test: ");
scanf("%ld", &n);
printf("Result: %s\n", isPrime(n)?"Is a Prime.":"Not a Prime.");
}