Created
March 25, 2018 10:44
-
-
Save GokselKUCUKSAHIN/753e9921466333d9cae8d8583263b26e to your computer and use it in GitHub Desktop.
C-Programlama I (Project 21-30)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
//Dörtgen çizme yazılımı | |
int main(void) | |
{ | |
int x,y; //kordinat değişkenlerim | |
printf("X ekseni -> "); scanf("%d",&x); //X kordinatı | |
printf("Y ekseni -> "); scanf("%d",&y); //Y kordinatı | |
printf("x=%d, y=%d\n\n",x,y); //aldığımız değerler | |
int i,j; | |
for (j=y;j>=1;--j) | |
{ | |
for(i=x;i>=1;--i) | |
printf("X "); | |
printf("\n"); | |
} | |
printf("\n"); | |
system("PAUSE"); | |
return 0; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int faktoriyel(int); | |
int kombinasyon(int,int); | |
int main(void) | |
{ | |
int a,b,sonuc; | |
printf("Kacin kacli kombinasyonu hesaplancak -> "); scanf("%d%d",&a,&b); | |
sonuc=kombinasyon(a,b); | |
printf("\n\nKombinasyonu(%d,%d)=%d\'dir.\n\n",a,b,sonuc); | |
return 0; | |
} | |
int faktoriyel(int a){ | |
int i,f=1; | |
for(i=2;i<=a;i++) | |
f*=i; | |
return(f); | |
} | |
int kombinasyon(int n,int r){ | |
int deger; | |
deger = faktoriyel(n)/(faktoriyel(r)*faktoriyel(n-r)); | |
return(deger); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
float daire(int); | |
int kare(int); | |
int dikdortgen(int,int); | |
int ucgen(int,int); | |
int main(void) { | |
int key,kenarA,kenarB,Yukseklik,Cap; | |
printf("Hangi seklin Alanini hesaplamak istiyorsunuz?\n\t1-Kare\n\t2-Dikdortgen\n\t3-Daire\n\t4-Ucgen\n"); | |
printf("? --> "); | |
scanf("%d",&key); | |
switch(key){ | |
case 1:{ | |
//kare | |
printf("\nKarenin Kenar Uzunlugunu girin -> "); scanf("%d",&kenarA); | |
printf("%d\n",kare(kenarA)); | |
break; | |
} | |
case 2:{ | |
//dikdörtgen | |
printf("\nDikdortgenin Kenarlarini girin:\n"); | |
printf("Kenar-1 -> "); scanf("%d",&kenarA); | |
printf("Kenar-2 -> "); scanf("%d",&kenarB); | |
printf("%d\n",dikdortgen(kenarA,kenarB)); | |
break; | |
} | |
case 3:{ | |
//daire | |
printf("\nDairenin Capini girin -> "); scanf("%d",&Cap); | |
printf("%.3f",daire(Cap)); | |
break; | |
} | |
case 4:{ | |
//ucgen | |
printf("\nUcgenin Taban ve Yuksekligini girinin:\n"); | |
printf("Taban Uzungulunu girin -> "); scanf("%d",&kenarA); | |
printf("Yuksekligini girin ->"); scanf("%d",&kenarB); | |
printf("%d",ucgen(kenarA,kenarB)); | |
break; | |
} | |
default:{ | |
printf("Gecersiz Secim!\n"); | |
} | |
} | |
return 0; | |
} | |
int kare(int a){ | |
return(a*=a); | |
} | |
int dikdortgen(int a,int b){ | |
return(a*b); | |
} | |
float daire(int a){ | |
float Pi=22/7.0; | |
return(Pi*(a*a)); | |
} | |
int ucgen(int a,int b){ | |
return((a*b)/2); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
int x, *isaret; | |
x = 100; | |
isaret = &x; | |
printf("x in degeri = %d\n",x); | |
printf("x in adresi = %p\n",isaret); | |
printf("x in degeri = %d\n",*isaret); | |
printf("x in adresi = %p\n",&x); | |
system("PAUSE"); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
void takas(int *,int *); | |
int main(void) { | |
int a,b; | |
printf("Takas edilecek sayilari giriniz -> "); | |
scanf("%d %d",&a,&b); | |
printf("Takas oncesi : a=%d b=%d\n",a,b); | |
takas(&a,&b); | |
printf("Takas sonrasi: a=%d b=%d\n",a,b); | |
system("PAUSE"); | |
return 0; | |
} | |
void takas(int *x,int *y) | |
{ | |
int z; | |
z= *x; | |
*x=*y; | |
*y=z; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int *topla(int,int); | |
int main(void) { | |
int a,b; | |
int *p; | |
printf("Toplanacak iki sayiyi giriniz -> "); | |
scanf("%d %d",&a,&b); | |
p = topla(a,b); | |
printf("Iki sayisin toplami : %d (toplamin adresi %p)\n",*p,p); | |
system("pause"); | |
return 0; | |
} | |
int *topla(int x,int y) | |
{ | |
int *ptr,toplam; | |
toplam = x+y; | |
ptr = &toplam; | |
return ptr; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
//Pointer tipindeki fonksiyona örnek | |
//o fonksiyonun kendisini çağırana bir adres göndereceğini ifade eder | |
void caticiz(); | |
void katciz( int); | |
int main(void) { | |
int k; | |
printf("kac katli bina olsun? "); | |
scanf("%d",&k); | |
caticiz(); | |
katciz(k); | |
system("PAUSE"); | |
return 0; | |
} | |
void caticiz () | |
{ | |
printf(" * \n"); | |
printf(" *** \n"); | |
printf("*******\n"); | |
printf("-------\n"); | |
} | |
void katciz (int x) | |
{ | |
int i; | |
for(i=1;i<=x;i++){ | |
printf("l l\n"); | |
printf("-------\n"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
//Pointer tipindeki fonksiyona örnek | |
//o fonksiyonun kendisini çağırana bir adres göndereceğini ifade eder | |
int topla(int,int); | |
int main(void) { | |
int a,b,sonuc; | |
printf("Toplanacak iki sayiyi giriniz -> "); | |
scanf("%d %d",&a,&b); | |
sonuc = topla(a,b); | |
printf("iki sayinin toplami : %d \n",sonuc); | |
system("PAUSE"); | |
return 0; | |
} | |
int topla(int x,int y) | |
{ | |
int toplam; | |
toplam = x+y; | |
return toplam; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
//Pointer tipindeki fonksiyona örnek | |
//o fonksiyonun kendisini çağırana bir adres göndereceğini ifade eder | |
void topla(); | |
int main(void) { | |
topla(); | |
system("PAUSE"); | |
return 0; | |
} | |
void topla() | |
{ | |
int toplam; | |
int a,b; | |
printf("Toplanacak iki sayiyi giriniz -> "); | |
scanf("%d %d",&a,&b); | |
toplam = a+b; | |
printf("iki sayinin toplami : %d \n",toplam); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <ctype.h> | |
int Hesapla(int *adres,int boyut); | |
int RakamYap(char sayi) | |
{ | |
if(sayi=='0') | |
return 0; | |
else if(sayi=='1') | |
return 1; | |
else if(sayi=='2') | |
return 2; | |
else if(sayi=='3') | |
return 3; | |
else if(sayi=='4') | |
return 4; | |
else if(sayi=='5') | |
return 5; | |
else if(sayi=='6') | |
return 6; | |
else if(sayi=='7') | |
return 7; | |
else if(sayi=='8') | |
return 8; | |
else if(sayi=='9') | |
return 9; | |
else | |
return 76; | |
} | |
int main(void) | |
{ | |
char Dizge[50]; | |
int Sayilar[50]; | |
int yazdir; | |
printf("Max 50 karakterlik Dizge girin-> "); | |
gets(Dizge); | |
int i,isRakam,boyut=0,Rakam; | |
for(i=0;i<50;i++) | |
{ | |
isRakam=isdigit(Dizge[i]); | |
if(isRakam!=0) | |
{ | |
Rakam=RakamYap(Dizge[i]); | |
Sayilar[boyut]=Rakam; | |
// printf("%d\n",Rakam); | |
boyut++; | |
} | |
} | |
// puts(Dizge); | |
// printf("boyut=%d\n\n",boyut); | |
int *ptr; | |
ptr=&Sayilar[0]; | |
yazdir=Hesapla(ptr,boyut); | |
printf("%d\n",yazdir); | |
return 0; | |
} | |
int Hesapla(int *adres,int boyut) | |
{ | |
int i,toplam=0; | |
for(i=0;i<boyut;i++) | |
toplam+=*(adres+i); | |
return toplam; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
14/11/2017 ~~ 21/11/2017