Last active
November 13, 2017 22:24
-
-
Save GokselKUCUKSAHIN/141a1feefd1aff51606f38ee11175d68 to your computer and use it in GitHub Desktop.
C-Programlama I (Project_1-10)
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> //printf komutu için gerekli kütüphane. | |
#include <stdlib.h> //system("PAUSE"); için gerekli kütüphane. | |
int main(void) | |
{ | |
printf("Merhba Dunya!\n"); // (\n satır atlamaya yarıyor.) | |
printf("deneme1"); /* YORUM SATIRLARI */ | |
printf("Test 1\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> //printf komutu için gerekli kütüphane. | |
#include <stdlib.h> //system("PAUSE"); komutu için gereki kütüphane. | |
int main(void) { | |
int a=5;float p=-2.2/7.0; //a bir Integer(Tam sayı) ve değeri 5, p bir float(reel sayı) ve değeri -0.314285714 dir. | |
printf("a degiskeninin degeri %d\'dir.\n",a); //d int değerlerini yazdırır, %d şeklinde kullanılır. | |
printf("a degiskeninin degeri %2d\'dir.\n",a); //2 sayısı intin kaç basamaklı olduğunu belirtir. | |
printf("a degiskeninin degeri %3d\'dir.\n\n",a); | |
printf("p degiskeninin degeri %f\'dir.\n",p); | |
printf("p degiskeninin degeri %9.6f\'dir.\n",p); | |
printf("p degiskeninin degeri %10.6f\'dir.\n",p); | |
printf("p degiskeninin degeri %10.3f\'dir.\n",p); | |
printf("p degiskeninin degeri %e\'dir.\n",p); | |
printf("p degiskeninin degeri %14.6e\'dir.\n",p); | |
printf("p degiskeninin degeri %15.6e\'dir.\n",p); | |
printf("p degiskeninin degeri %15.3e\'dir.\n",p); | |
system("PAUSE"); // Programın hemen kapanmaması için DURAKLAT komutu. | |
return 0; //Programın bittiğini belirten komut. | |
} |
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> | |
#include <math.h> //Matematik kütüphanesi, sin() komutu için gerekli. | |
int main(void) | |
{ | |
float aci; | |
printf("acinin derece cinsinden degerini giriniz -> "); | |
scanf("%f",&aci); | |
float radyan=aci*(22/7.0)/180; //Raydan = Pi/180, Pi 22/7 olarak yaklaşık hesaplıyoruz | |
printf("\n%7.2f derecenin sinusu %5.3f\'dir.\n\n",aci,sin(radyan)); | |
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> // printf ve scanf komutları için gerekli kütüphane. | |
#include <stdlib.h> // system("PAUSE") komutu için gerekli kütüphane. | |
#include <math.h> // Matematik kütüphanesi. | |
int main(void) | |
{ //Dörtgen alan ve çevre hesaplama. | |
float a; //1. kenarın değeri, Reel | |
float b; //2. kenarın değeri, Reel | |
printf("Kenar-1\'i girin -> :"); //Bir değer girmemizi söyleyen printf komutu | |
scanf("%f",&a); //1. kenarın değerini isteyen scanf komutu, float a = scanf(%f,&a) | |
printf("Kenar-2\'i girin -> :"); //Bir değer girmemizi söyleyen printf komutu | |
scanf("%f",&b); //2. kenarın değerini isteyen scanf komutu, float b = scanf(%f,&b) | |
printf("Alani %.2f \n",a*b); //Dörtgenin alanını bize veren printf komutu. | |
printf("Cevresi %.2f \n",2*(a+b)); //Dörtgenin çevresini veren prtinf komutu. | |
system("PAUSE"); //Programın aniden kapanmasını engelleyen DURAKLAT komutu. | |
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 main(void) | |
{ | |
int sayi; | |
printf("Sayi girin -> "); | |
scanf("%d",&sayi); | |
if (sayi > 0) | |
{ | |
printf("Sayi pozitiftir\n"); | |
printf("-----\n"); | |
} | |
else if (sayi == 0) | |
{ | |
printf("Sayi sifirdir\n"); | |
printf("-----\n"); | |
} | |
else | |
{ | |
printf("Sayi negatiftir\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 main(void) | |
{ | |
int sayi; | |
printf("Bir sayi girin -> "); | |
scanf("%d",&sayi); | |
if (sayi == 1) | |
printf("sayi %d\'dir\n",sayi); | |
else if (sayi == 2) | |
printf("sayi %d\'dir\n",sayi); | |
else if (sayi == 3) | |
printf("sayi %d\'dur\n",sayi); | |
else | |
printf("%d Sayisi, 1, 2, 3 degildir\n",sayi); | |
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 main(void) | |
{ | |
float x,y,sonuc; | |
printf("X degerini giriniz -> "); | |
scanf("%f",&x); | |
printf("Y degerini giriniz -> "); | |
scanf("%f",&y); | |
if ((x < 0) && (y < 0)) | |
{ | |
printf("X ve Y\'nin ikisinin de Negatif olma durumu ile ilgili fonksiyon tanimsizdir\n"); | |
} | |
else if (x >= 0 && y >= 0) | |
{ | |
sonuc = x*y; | |
printf("%.3f\n",sonuc); | |
} | |
else if ((x >= 0) && (y < 0)) | |
{ | |
sonuc = x+y; | |
printf("%.3f\n",sonuc); | |
} | |
else | |
{ | |
sonuc = y-x; | |
printf("%.3f\n",sonuc); | |
} | |
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> | |
#include <math.h> | |
int main(void) | |
{ | |
float sonuc,kenar_1,kenar_2,karekenar,ucgenh,ucgent; int swtch; | |
printf("1- Dikdortgen alan hesaplama, 2- Kare alan hesaplama, 3- Ucgen alan hesaplama\n"); | |
printf("SECIM YAPINIZ -> "); | |
scanf("%d",&swtch); | |
switch (swtch) | |
{ | |
case 1: system("cls"); | |
printf("Dikdortgen Alan Hesaplamaya Hosgeldiniz\n\n"); | |
printf("Kenar-1 --> "); scanf("%f.3",&kenar_1); | |
if (kenar_1 <= 0) | |
{ | |
printf("HATALI DEGER GIRISI, Kenara 0 ya da daha kucuk deger giremezsiniz!"); | |
break; | |
} | |
printf("Kenar-2 --> "); scanf("%f.3",&kenar_2); | |
if (kenar_2 <= 0) | |
{ | |
printf("HATALI DEGER GIRISI, Kenara 0 ya da daha kucuk deger giremezsiniz!"); | |
break; | |
} | |
sonuc = (kenar_1*kenar_2); | |
printf("CEVAP = %.3f\n",sonuc); | |
break; | |
case 2: system("cls"); | |
printf("Kare Alan Hesaplamaya Hosgeldiniz\n\n"); | |
printf("Karenin Kenarini girin -> "); scanf("%f.3",&karekenar); | |
if (karekenar <= 0) | |
{ | |
printf("HATALI DEGER GIRISI, Kenara 0 ya da daha kucuk deger giremezsiniz!\n"); | |
break; | |
} | |
sonuc = (karekenar*karekenar); | |
printf("CEVAP = %.3f\n",sonuc); | |
break; | |
case 3: system("cls"); | |
printf("Ucgen Alan Hesaplamaya Hosgelniz\n\n"); | |
printf("Ucgenin Yuksekligini girin -> "); scanf("%f.3",&ucgenh); | |
if (ucgenh <= 0) | |
{ | |
printf("HATALI DEGER GIRISI, Yukseklik 0 ya da daha kucuk deger giremezsiniz!\n"); | |
break; | |
} | |
printf("Ucgenin Tabanini girin -> "); scanf("%f.3",&ucgent); | |
if (ucgent <= 0) | |
{ | |
printf("HATALI DEGER GIRISI, Taban Kenar 0 ya da daha kucuk deger giremezsiniz!\n"); | |
break; | |
} | |
sonuc = ((ucgenh*ucgent)/2); | |
printf("CEVAP = %.3f\n",sonuc); | |
break; | |
default: system("cls"); | |
printf("HATALI SECIM YAPTINIZ!!\n"); | |
printf("HATALI SECIM YAPTINIZ!!\n"); | |
printf("HATALI SECIM YAPTINIZ!!\n"); | |
} | |
printf("Bitti\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 main() | |
{ | |
int sayi; | |
int ciftsayi= 0; | |
printf("Sayi girisi -> "); | |
scanf("%d",&sayi); | |
while(sayi >=0) | |
{ | |
ciftsayi = (sayi%2); | |
if (ciftsayi == 0) | |
{ | |
printf("%d\n",sayi); | |
} | |
sayi = sayi -1; | |
} | |
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 main(void) | |
{ | |
int sayi,max=0,sayac=1; | |
printf("Pozitif bir sayi giriniz -> "); | |
scanf("%d",&sayi); | |
while (sayi>0) | |
{ | |
sayac=sayac +1; | |
if (sayi > max) | |
{ | |
max=sayi; | |
} | |
printf("Pozitif bir sayi giriniz -> "); | |
scanf("%d",&sayi); | |
} | |
if (sayac<2) | |
{ | |
printf("Gecersiz sayi girisi! \n"); | |
} | |
else | |
{ | |
printf("\n\nSu ana kadar girilen en buyuk sayi = %d\n\n",max); | |
} | |
system("PAUSE") | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
11/10/2017 ~~ 18/10/2017