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);
}



2.Given the short c program that follows a. make a list of the memory variables in this program ..

Answer / 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

More C Interview Questions

main() { float f1=10.5; double db1=10.5 if(f1==db1) printf("a"); else printf("b") }

2 Answers   CSC,


write a c program to find the sum of five entered numbers using an array named number

0 Answers   TATA,


1. Write a program to reverse every second word in a given sentence.

1 Answers  


How do you construct an increment statement or decrement statement in C?

0 Answers  


Why does the call char scanf work?

0 Answers  


Write a program to print prime nums from 1-20 using c programing?

13 Answers   IBM,


What is the difference between int and float?

3 Answers  


what is ram?

3 Answers   TCS,


#include <stdio.h> int main() { int i; for (i=0;i<3;++i) { fork();fork(); } } How many processes are created when running this program (including the initial one)? Explain &#1567;&#1567;&#1567;

4 Answers  


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

0 Answers  


Efficient data structure for store/search list of 1000 records a)array b)double linked list c)circular queue d)hash table

3 Answers   Value Labs,


second highest number in a given set of numbers

3 Answers   TCS,


Categories