Category: C

C Program to calculate the sum of Natural Numbers

Problem Write a program in C to take the input (n) from the user and calculate the sum of all the natural numbers from 1 to n. How to calculate the sum of natural numbers in C language ? Output Abundantcode.com coding sample                                                Enter a positive number : 4                                                 Result = 10

C Program to add two integers

Problem Write a program in C to add two integers and display the result on the screen. C Program to add two integers Output Enter first number : 1                                                                                                                                                            Enter second number : 2                                                                                                                                                                  1 + 2 = 3

C Program #3

What is the output of the following C program? Output Compiler error: 11 8 [Error] expected ‘;’ before ‘m’ Although the C program in the above sentence appears to be syntactically correct, compilation fails. class name for the reason. The compiler must be informed that main is the name of the class since that is its name. To create an object of a class or…

C Program #1

What is the output of the following C program? Output 14 13 The output of the sizeof operator is 14, which is the size of the string including the null character. While the strlen() function returns a string that is exactly 13 characters long, excluding null characters.

C Program #2

What is the output of the below C program? Output Constructor is executed Destructor is executed The first line of the main () function appears strange, but it is entirely legitimate. In C++, an object can be created without having its handle assigned to any pointer. Without any pointers pointing at it, this statement will produce an object of the class Test.

C Program to display half-pyramid using numbers

Problem Write a program in C to print  half-pyramid using numbers as shown.The program should take the number of rows as input. 1 1 2 1 2 3 1 2 3 4 How to create and display half-pyramid pattern in C using numbers? Output Abundantcode.com Coding samples Enter the No. of rows:4 1 1 2 1 2 3 1 2 3 4

C Program to find the version of C

In this post, you’ll learn how to find the version of C that is installed on your machine which you are using. C Program to find the version of C C comes in three different ISO versions: C90, C99, and C11. Check the following to see which C version your software is using:

C Program to find the ASCII Value of a Character

Problem Write a program in C to find the Ascii value of a character entered by the user and display the result on the screen. How to find the ASCII Value of a Character in C ? When the user enters the character A , the value 65 (Ascii value) should be displayed on the screen. Here’s a C program for it. Output Enter a…

C Program to display Positive factors of a number

Problem Write a program in C to display all the positive factors of a number enter by the user. How to find and display positive factors of a number in C ? Below is a program in C demonstrating how to do it. Output Abundantcode.com coding sample Enter a Number :5 Positive factors of the number 5 are below: 1 5

C Program to display inverted full pyramid using *

Problem Write a program in C to print inverted full pyramid using * as shown below.The program should take the number of rows as input. * * * * * * *     * * * * *       * * *         * How to create and display inverted full pyramid using * ? Output Abundantcode.com Coding samples Enter number of rows: 4 *…

C Program to find if a character is a Vowel or Consonant

Problem Write a program in C to check whether a given character is a vowel or consonant. How to check if a character is a vowel or consonant in C Language ? In English , the alphabets A, E, I, O and U are vowels and the rest of the characters are consonants. Here’s a program that takes an input character from the user and…

C Program to Multiply two Floating Point Numbers

Problem Write a program in C to multiply two floating point numbers and then display the output on the console window. C Program to Multiply two Floating Point Numbers Output Enter two numbers: 6 7                                                                                                                                                        Product = 42.00

C Program to display Inverted half-pyramid using *

Problem Write a program in C to print Inverted half-pyramid using * as shown below.The program should take the number of rows as input. * * * * * * * * * * How to create and display Inverted half-pyramid pattern in C using * ? Output Abundantcode.com Coding samples Enter the limit : 4 * * * * * * * * *          …