English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

#include
#include
#include
#include
main(){
char n;
clrscr();
printf("enter any single character...");
scanf("%c",&n);
if(isupper(n))
{
printf("given character is a uppercase alphabet\n");
exit(0);
}
printf("given character is not a uppercase alphabet");
getch();
}

2007-05-23 08:33:05 · 3 answers · asked by thyagarajan 4 in Computers & Internet Programming & Design

3 answers

i use c++, you dont use else in c? if you do, then your code is wrong, (you might notice that your {} are wrong as well),it should be:

if(isupper(n))
{
printf("given character is a uppercase alphabet\n");
exit(0);
}
else
{
printf("given character is not a uppercase alphabet");
getch();
}


----EDIT----
apparently you do use else, so yeah, thats your problem.

http://www.cprogramming.com/tutorial/c/lesson2.html

2007-05-23 08:40:54 · answer #1 · answered by No Name 4 · 1 0

#include
#include
#include
#include
main(){
char n;
clrscr();
printf("enter any single character...");
n=getchar();
if(isupper(n))
{
printf("given character is a uppercase alphabet\n");
exit(0);
}
printf("given character is not a uppercase alphabet");
getch();
}


Try this. it can help.

2007-05-23 09:33:14 · answer #2 · answered by yaramala 2 · 0 0

nn is right, you are likely getting BOTH messages, instead of getting just one.

2007-05-23 09:03:35 · answer #3 · answered by Kasey C 7 · 0 0

fedest.com, questions and answers