Created
January 6, 2019 20:17
-
-
Save savolla/78da6d8654f41ac1293147f5e373f46a to your computer and use it in GitHub Desktop.
final 4. soru
This file contains 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 <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