Skip to content

Instantly share code, notes, and snippets.

@chintanparikh
Created May 29, 2013 03:43
Show Gist options
  • Save chintanparikh/5667841 to your computer and use it in GitHub Desktop.
Save chintanparikh/5667841 to your computer and use it in GitHub Desktop.
//
// 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