I have made a few programs viz the pascals triange (it took me 10 mins to figure out how to print out the numbers in a perfect triangle) and fibonnici series (easy
1 1 2 3 5 8 13 21 34 55)
But i still dont know how i can print the asci value of a number .....
Question 1: Given a character variable, how can you print its ascii value
Question 2: Taking the input from the keyboard convert it (digit or an alphabet) into the corresponding alphabet or digit (respectively) by using the ascii chart.
So far i have done so much ..... really nothing much
TurboC doesnt allow pasting here
....
* John Anderton opens file in notepad ....
code:
/* Header Files */
#include <stdio.h>
#include <conio.h>
/* Global Variables */
char a;
void main ()
{
/* Clean Slate */
clrscr();
/* Input */
printf("Enter a alphanumerical character (ie Alphabet or a digit ");
a = getchar();
putchar('\n');
/* If loop to identify datatype */
if (isalpha(a) > 1)
printf("%c",a);
/* Correction reqd there ^^ */
else if (isdigit(a) > 1)
printf("%c",a);
/* And there too ^^ */
else
printf("Only alpha numericals alowed. %c is now allowed",a);
/* Applying glue on the output screen */
getch();
}
Someone please help quick
And dz why does the [code] tag parse emotes