hello...i am new here and also new in IT enviroment,
try to do my assignment as below

Write C program that accept a character using scanf () function,if the character is lowercase letter,convert to uppercase letter and display the letter in its uppercase form, if the character is uppercase, convert the letter to lowercase and display the letter in its lowercase form,
if character entered is not an alphabet (!, @, 2) or any non alphabet, display 0

please help..im getting blur

Recommended Answers

All 5 Replies

char char1;
int i1;

printf("Enter character :");
scanf("%c", &char1);

i1 = (int)char1;
if(i1>=97 && i1<=122)
{
        i1 -= 32;
}


if(i1>=65 && i1<=90)
{
        printf("%c",i1);
}
else
{
        printf("invalid char");
}
commented: fail -2
commented: Don't do other people's homework +0

Start with the program which simply prints what you type in.

Then you've got something to work with for the next step, say determining the case.

Post when you've got code, AND are stuck.

Start with the program which simply prints what you type in.

Then you've got something to work with for the next step, say determining the case.

Post when you've got code, AND are stuck.

i already start with simple program,look like it easy, but when come to more complicated program, dont know what to do,

maybe its a late start for me to do programming, i am 33years old, taking online learning, with work and family...

So post your easy program, then tell us which step you think you need to do next, and where in the code it might go.
We'll be here to guide you.

i already start with simple program,look like it easy, but when come to more complicated program, dont know what to do,

maybe its a late start for me to do programming, i am 33years old, taking online learning, with work and family...

Salem's guidance is really splendid. You need to try once more. You do have very simple inbuilt functions like isalpha(),toupper(),tolower() etc to serve your purpose which you have mentioned in your post.

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.