Skip to content

Instantly share code, notes, and snippets.

@ggmichaelgo
Created June 16, 2014 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ggmichaelgo/23af573abb3c36fabf39 to your computer and use it in GitHub Desktop.
Save ggmichaelgo/23af573abb3c36fabf39 to your computer and use it in GitHub Desktop.
Floyd
import java.util.Scanner;
public class Floyd
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
for(int n=0 ; n<3 ; n++)
{
int number = input.nextInt();
int row=1, column=0;
while(number>0)
{
number--;
if(column == row)
{
row++;
column=0;
}
column++;
}
System.out.println("R" + row + " C" + column);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment