C Functions

In this C tutorial we learn how to functions allow us to group multiple statements together for reuse in our program. We cover how to define a function and prototype, how to use (call) a function, how to accept parameters, and how to return a value from a function. Let’s jump right in. What is … Read more

Categories C

C Program to Print Pyramids and Patterns

In this example, you will learn to print half pyramids, inverted pyramids, full pyramids, inverted full pyramids, Pascal’s triangle, and Floyd’s triangle in C Programming. Adobe Creative Cloud for Teams starting at $33.99 per month.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C if…else Statement C for … Read more

C Program to Display its own Source Code as Output

In this example, you’ll learn to display source of the program using __FILE__ macro. Adobe Creative Cloud for Teams starting at $33.99 per month.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Preprocessor and Macros C File Handling Though this problem seems complex, the concept behind this … Read more

C Program to Calculate Difference Between Two Time Periods

In this example, you will learn to calculate the difference between two time periods using a user-defined function. Adobe Creative Cloud for Teams starting at $33.99 per month.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C User-defined functions C struct C Structure and Function C structs and … Read more

C Program to Add Two Complex Numbers by Passing Structure to a Function

In this example, you will learn to take two complex numbers as structures and add them by creating a user-defined function. Limited time offer: Get 10 free Adobe Stock images.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C struct C Structure and Function Add Two Complex Numbers … Read more

C Program to Sort Elements in Lexicographical Order (Dictionary Order)

In this example, you will learn to sort 5 strings entered by the user in the lexicographical order (dictionary order). Get $100 of free cloud computing. Build and deploy your app with the industry’s leading price-performance.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Multidimensional Arrays C … Read more

C Program to Count the Number of Vowels, Consonants and so on

In this example, the number of vowels, consonants, digits, and white-spaces in a string entered by the user is counted. Adobe Creative Cloud for Teams starting at $33.99 per month.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Arrays C Programming Strings Program to count vowels, consonants … Read more

C Program to Multiply two Matrices by Passing Matrix to a Function

In this example, you’ll learn to multiply two matrices and display it using user defined function. Limited time offer: Get 10 free Adobe Stock images.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Arrays C Multidimensional Arrays Pass arrays to a function in C This program asks … Read more

C Program to Multiply Two Matrices Using Multi-dimensional Arrays

In this example, you will learn to multiply two matrices and display it using user-defined functions. Limited time offer: Get 10 free Adobe Stock images.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Arrays C Multidimensional Arrays This program asks the user to enter the size (rows … Read more

C Program to Add Two Matrices Using Multi-dimensional Arrays

In this example, you will learn to add two matrices in C programming using two-dimensional arrays. Students and Teachers, save up to 60% on Adobe Creative Cloud.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Arrays C Multidimensional Arrays Program to Add Two Matrices Output Enter the … Read more

C Program to Convert Binary Number to Octal and vice-versa

In this example, you will learn to convert binary numbers to octal and vice versa manually by creating a user-defined function. Adobe Creative Cloud for Teams starting at $33.99 per month.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Functions C User-defined functions Program to Convert Binary … Read more

C Program to Convert Octal Number to Decimal and vice-versa

In this example, you will learn to convert octal numbers to decimal and vice-versa manually by creating a user-defined function. Limited time offer: Get 10 free Adobe Stock images.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Functions C User-defined functions Example 1: Program to Convert Decimal … Read more

C Program to Convert Binary Number to Decimal and vice-versa

In this example, you will learn to convert binary numbers to decimal and vice-versa manually by creating a user-defined function. Get $100 of free cloud computing. Build and deploy your app with the industry’s leading price-performance.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Functions C User-defined … Read more

C Program to Check Prime or Armstrong Number Using User-defined Function

In this example, you will learn to check whether an integer is a prime number or an Armstrong or both by creating two separate functions. Deploy more with Linux VMs, S3-compatible object storage & global infrastructure. $100 in free credits.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: … Read more

C Program to Make a Simple Calculator Using switch…case

In this example, you will learn to create a simple calculator in C programming using the switch statement. Limited time offer: Get 10 free Adobe Stock images.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C switch Statement C break and continue This program takes an arithmetic operator +, … Read more

C Program to Find LCM of two Numbers

In this example, you will learn to calculate the LCM (Lowest common multiple) of two numbers entered by the user. Students and Teachers, save up to 60% on Adobe Creative Cloud.ADS VIA CARBON To understand this example, you should have the knowledge of the following C programming topics: C Programming Operators C if…else Statement C while and … Read more

C “Hello, World!” Program

In this example, you will learn to print “Hello, World!” on the screen in C programming. To understand this example, you should have the knowledge of the following C programming topics: C Input Output (I/O) Program to Display “Hello, World!” Output Hello, World! How “Hello, World!” program works? The #include is a preprocessor command that tells the compiler to … Read more