How to print all the 26 alphabets in this order in C.

AbCdEfGh.....

it should print dynamically from a to z and do not print
this using pgm like this print("Ab......");

Use loops or anything to print all alphabets

Answers were Sorted based on User's Feedback



How to print all the 26 alphabets in this order in C. AbCdEfGh..... it should print dynamical..

Answer / jebarose

This can be done by using ASCII value...
ASCII value of A is 65
ASCII value of b is 98
Difference of Ab,Cd,Ef.(etc) is 33
A to C is 2.

This is the logic,while printing use %c,so tht it gets print
as Alphabets.

Is This Answer Correct ?    12 Yes 1 No

How to print all the 26 alphabets in this order in C. AbCdEfGh..... it should print dynamical..

Answer / nitin garg

#include<stdio.h>
#include<conio.h>
#include<math.h>

int main(){

char ch[26];
int a=65,b=98;
for(int i=0;i<26;i++)
{
ch[i]=a;
printf("%c ",ch[i]);
i++;
a=a+2;
ch[i]=b;
printf("%c ",ch[i]);
b=b+2;

}
getch();
return(0);
}

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static Which of the Following Statements are true w.r.t Bit-Fields A)a,b&c B)Only a & b C)Only c D)All

3 Answers   Accenture, Digg.com,


write a function to find whether a string is palindrome or not and how many palindrome this string contain?

2 Answers   Aptech,


what is the output for the code : main() { int i,j; printf("%d %d ",scanf("%d%d",&i,&j)); }

20 Answers   Infosys,


What are pointers? Why are they used?

0 Answers  


#include<stdio.h> main(0 { printf("\n %d %d %d",sizeof(3),sizeof("3"),sizeof(3)); }

4 Answers   HCL,






write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

0 Answers   Subex,


main() { int i=5; printf("%d",++i + i); } output is 10 ------------------------ main() { int i=5; printf("%d",i++ + i); }output is 12 why it is so? give appropiate reason....

2 Answers  


How can I access an I o board directly?

0 Answers  


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

0 Answers   L&T,


main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please explain me.How it is coming like that?

3 Answers   Excel,


whitch value return void main?

11 Answers  


write a program to fined second smallest and largest element in a given series of elements (without sorting)

9 Answers   Yahoo,


Categories