- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1082 Articles for Go Programming
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
351 Views
StepsRead all the three sides of the triangle and store them in three separate variables.Using the Heron's formula, compute the area of the triangle.Print the area of the triangle.Enter first side: 15Enter second side: 9Enter third side: 7Area of the triangle is: 20.69Enter first side: 5Enter second side: 6Enter third side: 7Area of the triangle is: 14.7ExplanationUser must enter all three numbers and store them in separate variables.First, the value of s is found which is equal to (a+b+c)/2Then, the Heron's formula is applied to determine the area of the triangle formed by all three sides.Finally, the area of the ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
388 Views
StepsRead two integers and store them in separate variables.Find the sum of the proper divisors of both the numbers.Check if the sum of the proper divisors is equal to the opposite numbers.If they are equal, they are amicable numbers.Print the final result.Enter number 1: 220Enter number 2: 284Amicable!Enter number 1: 349Enter number 2: 234Not Amicable!Example Live Demopackage main import "fmt" func main(){ var a, b int fmt.Print("Enter first number: ") fmt.Scanf("%d", &a) fmt.Print("Enter second number: ") fmt.Scanf("%d", &b) sum1 := 0 for i:=1; i
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
416 Views
StepsRead an integer and store it in a variable.Initialize a variable to count the sum of the proper divisors to 0.Use a for loop and an if statement to add the proper divisors of the integer to the sum variable.Check if the sum of the proper divisors of the number is equal to the variable.Print the final result.Enter any number: 6The number is a Perfect number!Enter any number: 25The number is not a Perfect number!Example Live Demopackage main import "fmt" func main(){ var n int fmt.Print("Enter any number: ") fmt.Scanf("%d", &n) sum1 := 0 for i:=1; ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
401 Views
StepsTake in the upper and lower range and store them in separate variables.Use a for loop which ranges from the lower range to the upper range.Find the numbers which are divisible by both 5 and 7.Print those numbers.Case 1Enter the lower range: 1Enter the upper range: 1003570Case 2Enter the lower range: 400Enter the upper range: 700420455490525560595630665700ExplanationUser must enter the upper range limit and the lower range limit.The for loop ranges from the lower limit to the upper limit.The value of i ranges from the lower limit to the upper limit.Whenever the remainder of i divided by 5 and 7 is ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
425 Views
Enter the number of elements to be in the list: 5Element: 45Element: 20Element: 80Element: 93Element: 3Largest even number: 80Largest odd number 93Enter the number of elements to be in the list: 4Element: 23Element: 10Element: 34Element: 89Largest even number: 34Largest odd number 89StepsEnter the number of elements of to be in the list.Define a size variable.Initialize an array with size.Take user's input for array.Iterate in the array, and compare oddRes and oddEven numbers for the largest.Print the largest evenRes and oddRes.Example Live Demopackage main import "fmt" func main() { fmt.Printf("Enter the number of elements to be in the list:") var ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
261 Views
StepsRead a number of elements to be in a list.Take the elements from the user using a for loop and append to a list.Using a for loop, get the elements one by one from the list and check if it is positive or negative.If it is positive, check if it is odd or even and find the individual sum.Find the individual sum of negative numbers.Print all the sums.Enter the number of elements to be in the list: 4Element: -12Element: 34Element: 35Element: 89Sum of all positive even numbers: 34Sum of all positive odd numbers: 124Sum of all negative numbers: -12Enter the ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
881 Views
StepsRead a number and store it in a variable.Print the multiplication table of the given number.Enter the number to print the table for: 77 x 1 = 77 x 2 = 147 x 3 = 217 x 4 = 287 x 5 = 357 x 6 = 427 x 7 = 497 x 8 = 567 x 9 = 637 x 10 = 70Enter the number to print the table for: 1717 x 1 = 717 x 2 = 3417 x 3 = 5117 x 4 = 6817 x 5 = 8517 x 6 = 10217 x 7 = 11917 x 8 = 13617 x 9 = 15317 x 10 = 170ExplanationUser must enter a number.Using a print statement, print the multiplication table of the given number.Example Live Demopackage main import "fmt" func main(){ var n int fmt.Print("Enter the number to print the multiplication table:") fmt.Scanf("%d", &n) for i:=1; i
![prashanth nallla](https://www.tutorialspoint.com/articles/images/user_icon.png)
388 Views
StepsTake the value of the integer and store it in a variable.Use a for loop and an if statement to generate the divisors of the integer.Print the divisors of the number.Enter an integer:25The divisors of the number are:1525The divisors of the number are: 2012451020ExplanationUser must first enter the value and store it in a variable.Use a for loop to generate numbers from 1 to n.Using an if statement, check if the number divided by i gives the remainder as 0 which is basically the divisor of the integer.Print the divisors of the number.Example Live Demopackage main import "fmt" func main(){ ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
385 Views
StepsTake the value of temperature in Celsius and store it in a variable.Convert it to Fahrenheit.Print the final result.Enter the temperature in Celsius: 32Temperature in Fahrenheit is: 89.6Enter the temperature in Celsius: 48Temperature in Fahrenheit is: 118.4ExplanationUser must first enter the value of temperature in Celsius.Using the formula: f=(c*1.8)+32, convert Celsius to Fahrenheit.Print the temperature in Fahrenheit.Example Live Demopackage main import "fmt" func main(){ var n int fmt.Print("Enter the temperature in Celsius:") fmt.Scanf("%d", &n) f:=(float32(n)*1.8)+32 fmt.Println("Temperature in Fahrenheit is:", f) }OutputEnter the temperature in Celsius:32 Temperature in Fahrenheit is: 89.6Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
215 Views
StepsTake the height in centimeters and store it in a variable.Convert the height in centimeters into inches and feet.Print the length in inches and feet.Enter the height in centimeters: 50The length in inches: 19.7The length in feet: 1.64Enter the height in centimeters: 153The length in inches: 60.28The length in feet: 5.02ExplanationUser must enter the height in centimeters.The height in centimeters is multiplied by 0.394 and stored in another variable which now contains the height in inches.The height in centimeters is multiplied by 0.0328 and stored in another variable which now contains the height in feet.The converted height in inches and ... Read More