What determines whether something is an invalid constant?
Consider a currency system in which there are notes of seven denominations, namely,Re.1,Rs.2,Rs.5,Rs.10,Rs.50,Rs.100.If a sum of Rs. N is entered through the keyboard, write a program to compute the smallest number of notes that will combine to give Rs. N
Consider a currency system in which there are notes of seven denominations, namely,Re.1,Rs.2,Rs.5,Rs.10,Rs.50,Rs.100.If a sum of Rs. N is entered through the keyboard, write a program to compute the smallest number of notes that will combine to give Rs. N
Read lessTwo numbers are input through the keyboard into two locations C and D.Write a program to interchange the contents of C and D.
Two numbers are input through the keyboard into two locations C and D.Write a program to interchange the contents of C and D.
Read lessIf value of an angle is input through the keyboard, write a program to print all its trigonometric ratios.
If value of an angle is input through the keyboard, write a program to print all its trigonometric ratios.
Read lessIf length of three sides of a triangle are input through the keyboard, write a program to find the area of the triangle
If length of three sides of a triangle are input through the keyboard, write a program to find the area of the triangle
Read lessIf a five digit number is input through the keyboard, write a program to reverse the number.
If a five digit number is input through the keyboard, write a program to reverse the number.
Read lessIf a five digit number is input through the keyboard, write a program to calculate the sum of its digits.
If a five digit number is input through the keyboard, write a program to calculate the sum of its digits.
Read lessPoll Results
Participate in Poll, Choose Your Answer.
Poll Results
No votes. Be the first one to vote.
Participate in Poll, Choose Your Answer.
Poll Results
No votes. Be the first one to vote.
While defining a constant there are some rules that must be followed. for example: To define integer constant rules are: -It must have at least one digit. -There must be no decimal point. -It does not allow any blanks or commas. -An integer constant can be both negative and positive. -We assume an iRead more
While defining a constant there are some rules that must be followed.
for example: To define integer constant rules are:
-It must have at least one digit.
-There must be no decimal point.
-It does not allow any blanks or commas.
-An integer constant can be both negative and positive.
-We assume an integer constant to be positive if there is no sign in front of that constant.
-The allowable range for this type of constant is from -32768 to 32767.
similarly, rules exist for the string constant, real constant, character constant, floating-point constant, etc.
Ex:
‘ab’ is an invalid character constant (since char must have only one literal)
25,234 is an invalid integer constant (since is not an integer)
25 is an invalid floating-point constant (since it doesn’t contain . a period), etc.
See less