i need help to solve this

#include <stdio.h>
#include <stdlib.h>

void toLowerCase();

int main()

{
    system("cls");
        toLowerCase();


        return 0;

}


void toLowerCase()
{
    char ch, ch1;
    printf("\nEnter a character to convert: \n ");
    scanf("%c", &ch);
    ch1 = ch+32;
    printf("Converted value is %c", ch1);
    fflush(stdout);

}

Recommended Answers

All 3 Replies

The prototype should be:

void toLowerCase(void);

If you are receiving other warnings or errors, list them. If it's giving you wrong output, or messing up your input for some reason, show an example.

To troubleshoot a program, you have to be active and work at it.

P.S. What is the square brackets at the very top and bottom, about? If you want code tags (and you do need them for code), click on the CODE icon in the editor, and paste your code between the provided tags.

thanks i was able to find the problem only that i need it to add

void toLowerCase()
{
    char ch, ch1;

    printf("\nEnter a character to convert: \n ");
    fflush(stdout);
    scanf("%c", &ch);
    ch1 = ch-32;
    printf("Converted value is %c ", ch1);
    fflush(stdout);

}

and it worked fine, but thanks for the help

I don't like the idea that you are assuming that the user will always enter a capital letter. Why are you not using this?

#include <stdio.h>
#include <ctype.h>
ch1 = tolower(ch);

Its safer in that it checks weather the user typed upper-case or not.

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.