alphabet from lower to upper , using ascii
what logic should be use to convert small letters into capital using ascii codes??
for example ascci code for A is 65 and ascii code for a is 97
how can i coonvert from integers to character ?

int number = 65;
char letter = number;

There are no characters in C only integers with different ranges. A character is no more than a number that is interpreted by the display sub-systems to write pixels on the screen in a forum that you recognise as a letter.

What about using char ch = 'a'; and then ch++; 26 times?

char toCap = 'a';
toCap -= ('a' - 'A');

int integer = 0;
integer += 'a' for lowercase,

Now print it with a %c and with a %d :)

And what would it be to change an integer into uppercase?

Check out toupper() and tolower(), as well.

Do you know this feature of characters in C?

char ch = 'A';
ch = ch + 1;
printf("%c", ch);

Output

B

Now, you said ASCII code of 'A' = 65 & ASCII code of 'a' = 90, hence try to figure how much you should add/subtract from a character to convert into uppercase/lowercase

alphabet from lower to upper , using ascii
what logic should be use to convert small letters into capital using ascii codes??
for example ascci code for A is 65 and ascii code for a is 97
how can i coonvert from integers to character ?

Such confusing responses....

What is the difference (numerically) between 'A' and 'a'?
What about 'B' and 'b'?
'C' and 'c'?
Notice a pattern?

Therein lies your logic for conversion.

<pedantic>
Most of the above posts make the following assumptions

  1. 'B' - 'A' == 'C' - 'B' == ... == 'z' - 'y' == 1 and similarly for all letters that are adjacent in the alphabet.

  2. 'a' - 'A' == 'b' - 'B' == ... == 'z' - 'Z' and similarly for all lower case upper case letter pairs in the alphabet.

These relationships between the numeric values of letters are not a function of C (or C++) but rather a function of the execution character set in use, in this case ASCII. The C standard does not require the use of ASCII as the execution character set or in fact any particular character set and does not require the relationships 1 and 2 above. It does require that

'1' - '0' == '2' - '1' == '3' - '2' == '4' - '3' == '5' - '4' ==
'6' - '5' == '7' - '6' == '8' - '7' == '9' - '8' == 1

There are some character sets where the letters do not have contiguous character values EBCDIC is the example normally given where 'J' - 'I' == 8.

While a very large number of today's platforms use ASCII as their compilation and execution character set there are still some platforms (mobile phones spring to mind, or at least the SMS parts of them) that don't.

It is normally easy enough to get round this character set limitation using functions provided in ctype.h such as toupper.
</pedantic>

Thanks alot everyone...!
through your Help i've done my Program and it is now converting the input alphabet into upper case :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.