Professional Documents
Culture Documents
#include<iostream.h>
main(){
int m,n;
cin>>m>>n;
double x,y,z;
cin>>x>>y>>z;
char c1,c2,c3,c4;
cin>>c1>>c2>>c3>>c4;
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: