Computer Science, asked by swithiks, 1 month ago

given the values of three variables a,b,c write c program to compute and display the values of your choice . display your name on console along with the result​

Answers

Answered by rajarshh
0

Answer:

heyaaaaaa ur answerrrrr is π hope it helps


swithiks: no
rajarshh: yes
swithiks: it is abt c programming
Answered by Swaradeshmukh749
0

Answer:

Displaying the Values of Variables

The printf routine is the most commonly used routine in this book. This is because it provides an easy and convenient means to display program results. Not only can simple phrases be displayed, but the values of variables and the results of computations can also be displayed. In fact, Program 3.4 uses the printf routine to display the results of adding two numbers, namely 50 and 25.

Program 3.4 Displaying Variables

#include <stdio.h>

int main (void)

{

int sum;

sum = 50 + 25;

printf ("The sum of 50 and 25 is %i\n", sum);

return 0;

}

Program 3.4 Output

The sum of 50 and 25 is 75

In Program 3.4, the first C program statement declares the variable sum to be of type integer. C requires that all program variables be declared before they are used in a program. The declaration of a variable specifies to the C compiler how a particular variable will be used by the program. This information is needed by the compiler to generate the correct instructions to store and retrieve values into and out of the variable. A variable declared as type int can only be used to hold integral values; that is, values without decimal places. Examples of integral values are 3, 5, –20, and 0. Numbers with decimal places, such as 3.14, 2.455, and 27.0, for example, are known as floating-point or real numbers.

The integer variable sum is used to store the result of the addition of the two integers 50 and 25. A blank line was intentionally left following the declaration of this variable to visually separate the variable declarations of the routine from the program statements; this is strictly a matter of style. Sometimes, the addition of a single blank line in a program can help to make the program more readable.

The program statement

sum = 50 + 25;

reads as it would in most other programming languages: The number 50 is added (as indicated by the plus sign) to the number 25, and the result is stored (as indicated by the assignment operator, the equal sign) in the variable sum.

The printf routine call in Program 3.4 now has two items or arguments enclosed within the parentheses. These arguments are separated by a comma. The first argument to the printf routine is always the character string to be displayed. However, along with the display of the character string, you might also frequently want to have the value of certain program variables displayed. In this case, you want to have the value of the variable sum displayed at the terminal after the characters

The sum of 50 and 25 is

are displayed. The percent character inside the first argument is a special character recognized by the printf function. The character that immediately follows the percent sign specifies what type of value is to be displayed at that point. In the preceding program, the letter i is recognized by the printf routine as signifying that an integer value is to be displayed.2

Similar questions