Excel labels its rows with letters. For example row 0 is labeled 'A', row 1 is labeled 'B', row 26 is labeled 'AA', and so on.
Design, and implement in C, an algorithm that will map any row number, such as 2842, into into its proper row designation. For instance row 2842, maps to the designation 'DEI'
input=2842
printLabel(int input)
{
if( input < 26)
printf("%d",input +'A');
else
{
printLabel(input/26);
printf("%d",input%26+'A')
}
}
There is a small correction in the above program
void printLabel(int input)
{
if( input < 26)
printf("%c",input +'A');
else
{
printLabel(input/26 -1);
printf("%c",input%26+'A');
}
}
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks