Skip to content

Instantly share code, notes, and snippets.

View edenizk's full-sized avatar
:shipit:
🐱‍💻

Ergin Deniz Kosecioglu edenizk

:shipit:
🐱‍💻
View GitHub Profile
@edenizk
edenizk / links.sh
Created May 11, 2018 17:13
links in Linux
@edenizk
edenizk / swap.c
Created May 11, 2018 17:12
Swap in C
#include <stdio.h>
void swap(float *p1,float *p2){
float tmp;
tmp=*p1;
*p1=*p2;
*p2=tmp;
printf("p1=%f , p2=%f\n",p1,p2);
}
@edenizk
edenizk / array.c
Created May 11, 2018 17:11
Arrays in C
#include <stdio.h>
float minm(float a1[],int size);
int main()
{
float a1[]={2.5,5.7,1.2,2.1,4.3};
float *p;
p=a1;
while(p<a1+sizeof(a1)/sizeof(float))
@edenizk
edenizk / stringDynamic.c
Created May 11, 2018 17:10
Dynamic Strings
#include <stdio.h>
#include <stdlib.h>
unsigned scat(char *s, char *s2)
{
int i,j;
for(i=0;s[i]!=0; i++);
s[i++]=32;
for(j=0;s2[j]!=0;j++){
s[i]=s2[j];
i++;
@edenizk
edenizk / strings.c
Created May 11, 2018 17:10
strings in C language
#include <stdio.h>
unsigned scat(char *s, char *s2)
{
int i,j;
for(i=0;s[i]!=0; i++);
s[i++]=32;
for(j=0;s2[j]!=0;j++){
s[i]=s2[j];
i++;
}
@edenizk
edenizk / decimallenght.py
Created May 11, 2018 17:07
checks decimal lenght
x = int(eval(input("x = ") ) )
k = int(input("k = "))
print(k , "position digit = ", (abs(x) // 10 ** k) % 10)
print(k , "position digit = ", (abs(x) // 10 ** k) % 2)
print ("length of the decimal number = ", len(str(x)))
print ("length of the binary number = ", len(str(bin(abs(x))))-2, )
@edenizk
edenizk / toruscal.py
Created May 11, 2018 17:07
toruscal calculator
import math
print('TOrus calculator\n')
R=float(input('major radius R = '))
r=float(input('minor radius r = '))
area = (2*math.pi*R)*(2*math.pi*r)
vol = (math.pi*r**2)*(2*math.pi*R)
print("area = ",area)
print("volume = ",vol)
#include <iostream>
#include <string>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
/*
int length ( char s [] ){
int i=0;
for(; s[i]!='\0';i++);
return i;
@edenizk
edenizk / areaperimeter.cpp
Created May 11, 2018 17:03
area-perimeter calculator
#include <iostream>
#include <cmath>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
//int tri, squ, rect, rho, para, tra, pent, hex, oct;
int i, o=0, d, k;
float sum, a, b, c, z;
@edenizk
edenizk / salary.cpp
Created May 11, 2018 16:58
salary calculator
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int BS,NH,HR,OV,CP,x,y,a,k;
cout<<"enter how many hours you worked this week:";
cin>>NH;
cout<<endl;
cout<<"enter hours rate: ";