Preview

c Codes

Good Essays
Open Document
Open Document
14476 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
c Codes
Find Area and perimeter of circle in c code. This c program makes a contrasting concept that how a return statement can return more than one value. Usually in C programming we make a call by value. This means that in general you cannot alter the actual arguments. But if desired, it can always be achieved through a call by reference. Using a call by reference intelligently we can make a function return more than one value at a time, which is not possible ordinarily. This is shown in the c program find area and perimeter of circle given below.

Find Area and perimeter of circle in c code

#include
#include

int areaperi ( int r, float *a, float *p )
{
*a = 3.14 * r * r ; *p = 2 * 3.14 * r ; return (0);
}

int main( )
{
int radius ; float area, perimeter ; printf ( "\nEnter radius of a circle " ) ; scanf ( "%d", &radius ) ; areaperi ( radius, &area, &perimeter ) ; printf ( "Area = %f", area ) ; printf ( "\nPerimeter = %f", perimeter ) ; getch();
}

Find Area and perimeter of circle in c code. This c program makes a contrasting concept that how a return statement can return more than one value. Usually in C programming we make a call by value. This means that in general you cannot alter the actual arguments. But if desired, it can always be achieved through a call by reference. Using a call by reference intelligently we can make a function return more than one value at a time, which is not possible ordinarily. This is shown in the c program find area and perimeter of circle given below.

Find Area and perimeter of circle in c code

#include
#include

int areaperi ( int r, float *a, float *p )
{
*a = 3.14 * r * r ; *p = 2 * 3.14 * r ; return (0);
}

int main( )
{
int radius ; float area, perimeter ; printf ( "\nEnter radius of a circle " ) ; scanf ( "%d", &radius ) ; areaperi ( radius, &area, &perimeter ) ;

You May Also Find These Documents Helpful

  • Satisfactory Essays

    cout << "You are in factorial program of C++. Please enter a +ve integer:- ";…

    • 426 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Find each measurement. 1. the circumference of circle B 2. the area of circle R in terms of…

    • 3056 Words
    • 13 Pages
    Good Essays
  • Satisfactory Essays

    Comp 122 Week 1 Ilab

    • 662 Words
    • 3 Pages

    3. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get each input and to report each output.…

    • 662 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Comp122 Week 2 Homework

    • 301 Words
    • 2 Pages

    What values (if any) are assigned to x, y, and ch after each of these statements execute?…

    • 301 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Text that is written in a human-readable programming language that a computer can also interpret…

    • 290 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    a) This code is horrible because it returns the memory address of a local variable…

    • 775 Words
    • 2 Pages
    Good Essays
  • Good Essays

    When you get into programming loops in the C language, you discover the joys and dreads of endless, or infinite, loops. These loops continue forever because either the programmer forgot to include a way to exit from the loop or the exit condition is just never met. Either way, endless loops are a…

    • 733 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    Mth 110

    • 4756 Words
    • 20 Pages

    “The area of the circle of radius r is r 2 π” is a statement. So…

    • 4756 Words
    • 20 Pages
    Powerful Essays
  • Good Essays

    printf("\n See if you can find a balance between spendingtime with your \n family and time alone.");…

    • 1298 Words
    • 6 Pages
    Good Essays
  • Good Essays

    Because the sine function is computationally intensive, the program starts out by calculating a table of sine values for a complete cycle of 360 degrees. Changing the address at which the table lookup is begun produces a sine wave with a different phase. The table address is wrapped so that the value is always valid.…

    • 276 Words
    • 2 Pages
    Good Essays
  • Good Essays

    | |A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, C++ provides control structures that serve to specify what has to be done by our program, when and under which circumstances.…

    • 283 Words
    • 2 Pages
    Good Essays
  • Better Essays

    A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, C++ provides control structures that serve to specify what has to be done to perform our program.…

    • 1609 Words
    • 7 Pages
    Better Essays
  • Powerful Essays

    Empower the Masses

    • 827 Words
    • 4 Pages

    C is made up entirely of building blocks which have a particular ‘shape’ or form .A program is made up of functions, functions are made up of statements and declarations surrounded by curly braces { } .One and only one of these functions in the program must have the name main(). This function is always the starting point of a C program . The parentheses ‘()’ which follow the name of the function must be included even though they apparently serve no purpose at this stage.…

    • 827 Words
    • 4 Pages
    Powerful Essays
  • Good Essays

    Time Table

    • 518 Words
    • 3 Pages

    2013 COMSATS Institute Of Information And Technology Lahore, Pakistan 2013 COMSATS Institute Of Information And Technology Lahore, Pakistan Waheed Abbas DDP-BCS-FA11-088 Section “B” Submitted To: Miss Nosheen Majeed Waheed Abbas DDP-BCS-FA11-088 Section “B” Submitted To: Miss Nosheen Majeed 1. Draw a triangle strip with different colors for each triangle.…

    • 518 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    C Language

    • 5958 Words
    • 24 Pages

    C is a minimalistic programming language. Among its design goals were that it could be compiled in a straightforward manner using a relatively simple compiler, provide low-level access to memory, generate only a few machine language instructions for each of its core language elements, and not require extensive run-time support. As a result, C code is suitable for many systems-programming applications that had traditionally been implemented in assembly language.…

    • 5958 Words
    • 24 Pages
    Powerful Essays

Related Topics