C Programming Interview / Viva Q&A List

We’ll keep adding more and more C programming interview / viva question and answers to this list. Stay subscribed to our blog and YouTube channel.

You can also find full C programming video tutorial list here:
C Programming: Beginner To Advance To Expert

  1. C Programming Interview / Viva Q&A: 1 – assignment and eqality operators
  2. C Programming Interview / Viva Q&A: 2 – printf
  3. C Programming Interview / Viva Q&A: 3 (Logical Operator)
  4. C Programming Interview / Viva Q&A: 4 (Logical NOT Operator)
  5. Programming Interview / Viva Q&A: 5 (while loop)

Calculate Area of a Circle using math.h library: C

We can calculate area of circle if we know the value of its radius. So using that, we shall write the logic in c program to calculate the area of a circle, and we will us math.h library functions in this program.

Related Read:
Basic Arithmetic Operations In C

 
#include < stdio.h >
#include < math.h >

int main()
{
    float radius;

    printf("Enter radius of circle\n");
    scanf("%f", &radius);

    printf("Area of circle is %f \n", (M_PI * pow(radius, 2)));

    return 0;
}

Output:
Enter radius of circle
2.0
Area of circle is 12.566371

Scanf(): For user input

In above c program we are asking user to enter the values for variable a and b. You can know more about scanf() method/function in this video tutorial: Using Scanf in C Program

Calculate Area of a Circle using math.h library: C


[youtube https://www.youtube.com/watch?v=eTfQ6AmwGow]

YouTube Link: https://www.youtube.com/watch?v=eTfQ6AmwGow [Watch the Video In Full Screen.]


math.h library file has a constant M_PI which has the value of PI. Since it’s a constant variable we can not change its value in our program. We’re also using pow() method/function present in math.h header file.

Formula for calculating Area of a circle


area of circle

Formula for calculating Area of a circle is PI * radius * radius. We take value of radius from user and using above formula calculate area of the circle and output result to the console window. Since we’re using math.h library file we use M_PI and pow() methods for the expression.

i.e., area = M_PI * pow(radius, 2);

For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert

Ionic Video Tutorial List

On this page we’ll list all the Ionic Video Tutorials we produce. You can ask your questions in the comment section of the respective videos when you’ve any doubts related to the tutorial.


ionic-logo

Please support us by sharing this page with your friends on social media sites. Also stay subscribed to our blog and YouTube channel.

Enter your email address:

Ionic is a beautiful, open source front-end SDK for developing hybrid mobile apps with web technologies. Web technologies like angular, HTML5, CSS.

Ionic Free Video Tutorials List

  1. Ionic 2 Starter Templates
  2. Project Structure: Ionic 2
  3. Basics of Page Component: Ionic 2
  4. ngIf, index, first, last: Ionic 2
  5. Remove Element On Click: Ionic 2
  6. Basic Navigation: Ionic 2
  7. Details Arrow: Ionic 2
  8. Basics of Injectable or Providers: Ionic 2
  9. setTimeout and setInterval methods: Ionic 2
  10. ion-spinner Component: Ionic 2
  11. Passing Data Between Pages: Ionic 2
  12. Tappable Attribute: Ionic 2
  13. ngClass Directive: Ionic 2.
  14. Ionic Storage: Ionic 2.
  15. Ionic Storage Module: Ionic 2.
  16. Pull To Refresh: Ionic 2.
  17. List Item Reordering: Ionic 2.
  18. Using Ionic Native: Ionic 2
  19. Adding AdMob In Ionic 2
  20. Facebook Banner and Interstitial Ads: Ionic 2
  21. Facebook Native Ads: Ionic 2
  22. Facebook Native Ads Clickable Area: Ionic 2.

..more video tutorials coming soon, stay subscribed.

Ionic 1

  1. Getting Started With IONIC APP
  2. Positioning The Tabs: IONIC APPS
  3. Positioning The Title: IONIC APPS
  4. Ionic grid system
  5. IONIC APP – Open External Links In Mobile Browser
  6. Social Sharing Plugin: Ionic App