What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » C Programming Question

C Programming Question
Author: Message:
John Anderton
Elite Member
*****

Avatar

Posts: 3908
Reputation: 80
37 / Male / Flag
Joined: Nov 2004
Status: Away
O.P. C Programming Question
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 :-/
:blah:

This post was edited on 10-03-2005 at 06:50 PM by John Anderton.
[

KarunAB.com
]

[img]http://gamercards.exophase.com/459422.png[
/img]
10-03-2005 06:48 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
C Programming Question - by John Anderton on 10-03-2005 at 06:48 PM
RE: C Programming Question - by Yousef on 10-03-2005 at 07:03 PM
RE: RE: C Programming Question - by Plik on 10-03-2005 at 07:06 PM
RE: C Programming Question - by John Anderton on 10-03-2005 at 07:18 PM
RE: C Programming Question - by Plik on 10-03-2005 at 07:25 PM
RE: C Programming Question - by John Anderton on 10-03-2005 at 07:33 PM
RE: RE: C Programming Question - by segosa on 10-04-2005 at 06:09 AM
RE: C Programming Question - by J-Thread on 10-03-2005 at 08:27 PM
RE: C Programming Question - by John Anderton on 10-04-2005 at 07:45 AM
RE: C Programming Question - by RaceProUK on 10-04-2005 at 10:46 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On