Skip to content

Instantly share code, notes, and snippets.

@savolla
Created January 6, 2019 20:17
Show Gist options
  • Save savolla/78da6d8654f41ac1293147f5e373f46a to your computer and use it in GitHub Desktop.
Save savolla/78da6d8654f41ac1293147f5e373f46a to your computer and use it in GitHub Desktop.
final 4. soru
#include <iostream>
using namespace std;
int main(void)
{
int enBuyuk = 0; // 0 verdik çünkü 9 her zaman büyük olacak. referans olarak 0 verdik
int enKucuk = 9; // enBuyuk için yapılan şeyin aynısı
int islenecekSayi; // kullancıdan alınacak sayıyı tanımladık
short basamak;
cin >> islenecekSayi;
while(islenecekSayi != 0)
{
basamak = islenecekSayi % 10;
if(basamak > enBuyuk)
{
enBuyuk = basamak;
}
if(basamak < enKucuk)
{
enKucuk = basamak;
}
(int)(islenecekSayi /= 10);
}
cout << "en buyuk " << enBuyuk << endl;
cout << "en kucuk " << enKucuk << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment