Tagged: c programming examples

Write a C program that reads in a lowercase character, converts it to uppercase and then displays the uppercase equivalent 3

Write a C program that reads in a lowercase character, converts it to uppercase and then displays the uppercase equivalent

C program that converts lowercase character to its uppercase equivalent and displays it Explanation Step 1: Read the lowercase character Step 2: Convert the lowercase character to its uppercase by using the library function toupper() Step 3: Display the converted uppercase character Note: The function toupper() used in this program is a library function which is generally included in the header file ctype.h and the purpose of this function is to convert the lowercase letter to its uppercase. #include<stdio.h> #include<ctype.h> void main() { char lower, upper; lower = getchar(); upper = toupper(lower); putchar(upper); } Output: l L

Write a program in C that reads a line of text into the computer and then writes back out in its original form 3

Write a program in C that reads a line of text into the computer and then writes back out in its original form

Below is the C program that reads a line of text into the computer and then writes back out in its original form Explanation Step 1: Read the line of text by using the library function gets() and store it in an array Step 2: Display the read line by using the library function puts() Program: #include<stdio.h> void main() { char line[80]; gets(line); puts(line); } Output: Learn C Online is the best tutorial website to learn C Learn C Online is the best tutorial website to learn C

C Programming Examples 22

C Programming Examples

In this section you will find some useful C Programs. These programs have been written and tested in Turbo C. In case of any queries, do post a comment. Program to add two numbers using function (Pass by value method) Program to add two numbers using call by Reference Progarm to calculate Factorial of a given number Program to generate Fibonacci series Arithmetic calculator using switch statement Addition of Array elements Search first occurrence of element in an array Sort array in ascending order Sort array in descending order Reverse a given Number Calculate Length of a String (without using...

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet