See a problem in else if statement

Dangling else problem

Image
Hello, This problem comes when we use else if statement and do some mistake more describe is given below......... Dangling else problem: One of the major problem with nested if is dangling else problem. The problem arises when both outer if statement inner if statement might pair with common else statement. Thus the compiler is not able to judge to pair the else with which statement. The solution to this problem is given by the compiler that it pairs else with the recent if thus sometimes giving wrong result.                                           Hence the programmer should put early bracket wherever required. This post is may very short because my only aim was to describe this problem. Thank you, Keep supporting............. 

Reading and writing floating number

Hello guys, now here we will continue on reading and writing floate number in my last post we learn about integer number reading and writing.

Reading floating point no.:

Reading a floating point number we use scanf with format specifiers %f.


Writing floating point no.:

we use %wpf where w indicates the no. of position that a used to display a value and integer p indicates the no. of digit to be displayed after the decimal points. And printed right justified in the field off w colums leaded blanks and trailing ). The negative no.'s will be displayed with the (-) sign.

Ex.-

if value of a =56.7432

printf("%7.4f",a);

output-56.7462

print("%7.2f",a);

output-56.75

printf("%-7.2f",a);

output- _ _56.75

printf("%07.2f",a);

ouput- 0056.75

Normally you have to only remember that if you write any float no. as we show in example that 's first no. will indicate how many no. will display and after decimal which no. we use the no. will show after the decimal in output.
in reading and writing of float no. not so much only above example and how you use and when only remember.
Thank you,
If any doubt related to in this topic please comment friends.....

Comments

Popular posts from this blog

Libraray Fine Hackerrank solution in C || Balanced Brackets Hackerrank solution in C

Permutations of Strings hackerrank solution in C || Permutations of Strings

Introduction to C part 2