Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Relevant readings from text: K&R; Chapters 2 and 3. Write a program that prints

ID: 3793669 • Letter: R

Question

Relevant readings from text: K&R; Chapters 2 and 3. Write a program that prints the string "Hello, world! " to standard output. Note: You must name your file hello.c. Write a program that takes a character from standard input and then outputs one of three messages depending on whether the input is an uppercase letter, a lowercase letter, or any other character. At the start of the program, prompt the user to input a character by printing the string "Input one character: ". If the input is a lowercase letter, then print the string "You typed lowercase ", where is replaced with the character that was input by the user; if the input is an uppercase letter, then print the string "You typed uppercase "; otherwise, print the string "You did not type a letter. ". Example input/output pairs are provided below: Input: c; Output: You typed lowercase c. Input: R; Output: You typed uppercase R. Input: 6; Output: You did not type a letter. Input: $; Output: You did not type a letter.

Explanation / Answer

// Hello World

#include<stdio.h>

#include<conio.h>

int main()

{

       printf("Hello World");

       _getch();

    return 0;

}

// Case of Character

#include<stdio.h>

#include<string.h>

#include<conio.h>

int main() {

       int upper = 0, lower = 0;

       char ch;

       int i;

       printf(" Enter The Caracter: ");

       scanf("%c",&ch);

       if (ch >= 'A' && ch <= 'Z')

              upper++;

       if (ch >= 'a' && ch <= 'z')

              lower++;

      

       if (upper == 1)

              printf(" You typed Uppercase : %c", ch);

       else if (lower == 1)

              printf(" You typed Lowercase : %c", ch);

       else

              printf(" You didn't type a letter ");

      

       getch();

       return (0);

}