You are on page 1of 4

1.

Give output for C++ programming below:

#include<iostream.h>

main(){

int m,n;

cout<<"Enter two integers: ";

cin>>m>>n;

cout<<"m= "<<m<<" ,n= "<<n<<endl;

double x,y,z;

cout<<"Enter three decimal number: ";

cin>>x>>y>>z;

cout<<"x= "<<x<<" ,y= "<<y<<" ,z= "<<z<<endl;

char c1,c2,c3,c4;

cout<<"Enter four characters: ";

cin>>c1>>c2>>c3>>c4;

cout<<"c1= "<<c1<<"' c2= "<<c2<<" 'c3= "<<c3<<" 'c4= "<<c4<<endl;

return 0;}
2. Evaluate each of the following expressions, assuming each case that m=25 and n=7.

a. m – 8 – n = 25 – 8 – 7
=10

b. m % n = 25%7
=4

c. (m+n) * 4 = (25+7) * 4
= 128

d. (m%n) + 4 = (25%7) + 4
=8

e. m=n = FALSE

3. Give definition for logical error, run-time error and syntax error.

LOGICAL ERROR - logic error (sometimes called a semantic error) is a bug in a program that causes it
to operate incorrectly, but not to terminate abnormally (or crash). A logic error produces unintended
or undesired output or other behavior, although it may not immediately be recognized as such.

RUN-TIME ERROR – a “run-time error” is detected only during the execution of the program,
whereas a “compile-time error” is detected by the compiler before the program is started.

SYNTAX ERROR – refers to an error in the syntax of a sequence of characters or tokens that is
intended to be written in a particular programming language.
4. Write and run a program that print sum, difference, product, quotient for two
integers that are input interactively;

RESULT:
5.Write and run a program that prints the sum, difference, product, quotient for
two integers, initialize the integers with the value 60 and 7.

RESULT:

You might also like