Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
The series must be printed using for loop . The series is as follow
A
B
C
D
...
Z
AA
AB
AC
AD
..AZ
BA
BB
...

What I have tried:

I have tried to use append function but got garbage values
Posted
Updated 17-May-17 20:39pm
v2
Comments
CPallini 17-May-17 3:51am    
Show us what you tried, in detail.
RAMASWAMY EKAMBARAM 17-May-17 6:09am    
The series count is 702 - think how you can map 0 .. 701 to A .. ZZ using quotient (/) and modulus (%).
Patrice T 17-May-17 19:22pm    
And you have some code ?
RAMASWAMY EKAMBARAM 18-May-17 2:38am    
given as solution 2
Patrice T 18-May-17 2:51am    
Is it your solution or there is a problem in code ?
Use Improve question to update your question.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

So if you want help, you need to show us what you tried, not just post your homework question and hope we sort it out for you!
Start by looking at recursion, and don't forget to add a "termination condition" to limit the max length of the string - your series description doesn't do that and it is extremely important to fix and end before you start running the code!
Begin by writing a loop to print the "first set" - "A" to "Z" - and then think how you can use that to print the individual elements of the "second set" - "AA" to "AZ", "BA" to BZ", and so on - before you start trying to code anything to implement it.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
#include <stdio.h>

void main()
{
	char *str = " ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	int i;
	
	for(i = 0; i < 702; i++)
	{
		printf("%c%c\n", str[i/26], str[i%26 + 1]);
	}
}
 
Share this answer
 
Comments
Richard MacCutchan 18-May-17 4:06am    
You do not help people by doing their homework for them.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900