2.Given the short c program that follows
a. make a list of the memory variables in this program
b.which lines of code contain operations that change the
contents of memory? what are those operations?
Void main( void)
{
Double base;
Double height;
Double area;
Printf(“enter base and height of triangle :”);
Scanf(“%lg”, &base);
Scanf(“%lg”, &height);
Area=base*height/2.0;
Printf(“the area of the triangle is %g \n”,area);
}
Answer Posted / abdur rab
1 void main( void)
2{
3 double base;
4 double height;
5 double area;
6 printf("enter base and height of triangle :");
7 scanf("%lg", &base);
8 scanf("%lg", &height);
9 area=base*height/2.0;
10 printf("the area of the triangle is %g \n",area);
11}
Answer for a.
3 double base;
4 double height;
5 double area;
Answer for b.
7 scanf("%lg", &base);
8 scanf("%lg", &height);
9 area=base*height/2.0;
Operations
-----------
The scanf() function scans input from the file designated
by stdin under control of the argument format. The format
string here is %lg to get double. Following the format
string is the list of addresses of items to receive values.
and and assignment operation
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
List the difference between a "copy constructor" and a "assignment operator"?
How can I get the current date or time of day in a c program?
Can you define which header file to include at compile time?
Explain the priority queues?
How is a structure member accessed?
What is volatile variable how do you declare it?
What are loops c?
What is the difference between functions getch() and getche()?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
Can a variable be both static and volatile in c?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
Can a variable be both const and volatile?
What does static variable mean in c?
What is difference between structure and union in c?