Beautiful Codes for Beautiful Problems
Wednesday, 15 October 2014
Find excel column name given a number
void printString (int n)
{
string str;
while(n>0)
{
int rem = (n-1)%26;
char x = 'A'+rem;
str = (x+ str);
n = (n-1)/26;
}
cout<<endl<<str; }="">
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment