SLC21 Week1 - Learn more about variable types. Subroutines. Practice problems.
Assalam-o-Alaikum!!!
Greetings to my all Steemit member. I hope you will be fine and enjoying your best life on STEEMIT. I am also fine ALHAMDULILLAH. Today I am trying to share my homework tasks with you guys, I hope you will like and appreciate it more and more
In this code, it will give us a resut of 2 instead of 2.5, Even that if we simpley calcultae then its answer will be 2.5. But it will show 2. instead of 2.5. We can fix it by giveinf at least one operand is a floating point number. Because the result is included in decimal part
In this program we will use int data type. First we'll assign the inter data type so we can define integerand then we'll have a binary representation of the integers for its range. will and the minimum value for them should be If we subtract this minimum value one by one, it overflows which reaches the maximum positive value.
Why this happen
We all know that int has fixed range. Any operation that attempts to exceed the limit results in an overflow due to the way integers are represented in binary.
In this program we will use a loop to find out the required numbver. it will out the last number and add the last digit to the sum. After that we will remove it by dividing it by the tenth 10 day number. When the loop ends, the number will be zero and the sum of the digits will be printed.
SO the Output is
We'll use the operator here and start with the largest of the two numbers, then the three numbers, and then the four numbers as we go. This would be impractical for large sets of numbers. Will go and finally find the biggest one and give us a show
So the Output is:
We'll also add a ternary, which can be very helpful for dealing with small sets of values and searching for the largest of two, three, and four numbers. And using the ternary operand, we used the method of finding the largest number among the numbers, but in this we will solve this question by using the ternary method.
So the output is
Now its a turn of using the function max() to find out the largest number. And in this way we will find the greatest number by using this function
So the Output is:
There is a different function in this program when it will print the divisor of the air value and also omit the number itself, then return the sum of the divisors of a number and its leaves the number the range we set will find common numbers up to that range and print
So the Output is:
So here I completed all tasks. I tried my best to complete this. And I hope you will appreciate me
Special thanks to @sergeyk
Invite Frends: @ruthjoe , @abdullahw2 , @memamun