-
-
Save chintanparikh/5667841 to your computer and use it in GitHub Desktop.
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
// | |
// main.cpp | |
// 3 | |
// | |
// Created by Chintan Parikh on 5/28/13. | |
// Copyright (c) 2013 Chintan Parikh. All rights reserved. | |
// | |
#include <iostream> | |
using namespace std; | |
int main(int argc, const char * argv[]) | |
{ | |
long number = 13195; | |
int max = 0, i = 2; | |
while (number > 1) | |
{ | |
if (number % i == 0) | |
{ | |
if (i > max) | |
{ | |
max = i; | |
} | |
i = 2; | |
number /= i; | |
} | |
else | |
{ | |
i++; | |
} | |
} | |
cout << max; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment