Category: C

Undefined reference to `pow’ when compiling C program

When trying to make a simple program in C and compiling it , there are times when you might get an error that you are missing the pow function when you have used them inspite of including the math.h header file. The error message looks like this. undefined reference to ‘pow’ collect2: error: ld returned 1 exit status How to fix the error undefined reference…

C Program to display half-pyramid using alphabets

Problem Write a program in C to print half-pyramid using alphabets as shown below.The program should take the number of rows as input. A B B C C C D D D D How to create and display half-pyramid pattern in C using alphabets ? Output Abundantcode.com Coding samples Enter the limit : 4 A BB CCC DDDD

C Program to find GCD of two numbers

Problem Write a program in C to find the GCD of two numbers. How to find the GCD of two numbers in C ? GCD of two numbers refers to the largest integer value that can exactly divide both the number where the remainder is zero. Here’s a program in C demonstrating this. Output Abundantcode.com Coding Sample                                              Enter first Number: 24                                                Enter second Number: 18                                              …

C Program to display full pyramid using *

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

C Program to check if a Number is Positive or Negative

Problem Write a program in C to check whether a input number is a positive or negative number. How to check if a number is positive or negative in C ? Output Abundantcode.com coding samples                                                  Enter a number: 7                                                      The entered number is a positive number.

C Program to print a Half Pyramid using *

Problem Write a program in C to print Half pyramid using * as shown. * * * * * * * * * * * * * * * How to create and display Half Pyramid pattern in C ? Output Abundantcode.com Coding samples Enter the total number of rows: 5 * * * * * * * * * * * * * *…

C Program to find the factorial of a number using Recursive function

Problem Write a program in C to find the factorial of a number using recursion and display the result. How to find the factorial of a number using recursion in C ? The Formula to find the factorial of a number (n) is (n!) = 1*2*3*4….n Here’s a C program to demonstrate this. Output Abundantcode.com Coding samples Enter a Number : 5 Factorial of 5…

C Program to find if the input character is an Alphabet or not

Problem Write a program in C to check whether the character that was entered by the user is a alphabet or not. How to find if the input character is an alphabet or not in C ? Output Abundantcode.com Coding sample                                               Please enter a character: A                                              A is an alphabet.

C Program to find if the input is a Armstrong Number or Not

Problem Write a program in C to find if a given number is Armstrong number or not. How to check if a number is a Armstrong number or not in C programming Language ? A given number is a Armstrong number of order n if abc… = an + bn + cn + … For example , 371 is a Armstrong number because the result…

C Program to calculate the power of a number

Problem Write a program in C to calculate and display the power of a number. How to calculate the power of a number in C ? Output Abundantcode.com coding sample                                               Enter the base number: 2                                         Enter an exponent: 3                                              Answer = 6