Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

what is the result for the following expressions in C language ?

+1 vote
asked Nov 4, 2020 by DINESH 12011631 (180 points) 1 flag
1/10  =  ?  and 10/1 = ?
6/4 = ?  and 4/6 = ?

2 Answers

+1 vote
answered Nov 4, 2020 by Shivam Chauhan (160 points)
0 and 10

1 and 0
0 votes
answered Nov 4, 2020 by Saurav (150 points)
It depends on the type of data type.

If data type is integer type like int ,then value of above expressions are 0 , 10 , 1 , 0.

If data type is floating point type like float, double ,then value of above expressions are 0.100000 ,10.00000 ,1.50000 ,0.6666667.
commented Nov 5, 2020 by Peter Minarik (86,900 points)
Actually, the type is implicit in numeric constants. These are integral numbers (ints).

If you want a double constant, declare it as 1.23. If you want a float constant, declare it as 1.23f.

For more numeric constants, look at this for instance:

https://www.tutorialspoint.com/cprogramming/c_constants.htm
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...