fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n;
  5. printf("Enter the number of rows: \n");
  6. scanf("%d",&n);
  7.  
  8. /*int m;
  9.   printf("Enter the number of columns: \n");
  10.   scanf("%d",&m);*/
  11.  
  12. for(int i=1;i<=n;i++){
  13. int a=1;
  14. int d=65;
  15. for(int j=1;j<=i;j++){
  16. if(i%2!=0){
  17. printf(" %d ",a);
  18. a++;
  19. }
  20. else{
  21. char ch=(char)d;
  22. printf("%c",ch);
  23. d++;
  24. }
  25. }
  26.  
  27. printf("\n");
  28. }
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 5320KB
stdin
4

stdout
Enter the number of rows: 
 1 
AB
 1  2  3 
ABCD