Giter Club home page Giter Club logo

Anonna Ferdaus's Projects

11.scope icon 11.scope

The f function now has access to the x variable. Now suppose that we wrote this instead:

12.natural_number_sum icon 12.natural_number_sum

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.

14.constants icon 14.constants

Go also has support for constants. Constants are basically variables whose values cannot be changed later. They are created in the same way you create variables but instead of using the var keyword we use the const keyword:

15.scanf icon 15.scanf

We use another function from the fmt package to read the user input (Scanf). &input will be explained in a later chapter, for now all we need to know is that Scanf fills input with the number we enter.

16.foor_loop icon 16.foor_loop

The for statement allows us to repeat a list of statements (a block) multiple times.

17.if-else icon 17.if-else

If statements also have an optional else part. If the condition evaluates to true then the block after the condition is run, otherwise either the block is skipped or if the else block is present that block is run. If

18.functione1 icon 18.functione1

A function is a group of statements that exist within a program for the purpose of performing a specific task. At a high level, a function takes an input and returns an output.

19.functione2 icon 19.functione2

A function is an independent section of code that maps zero or more input parameters to zero or more output parameters.

2.add icon 2.add

An example program using numbers.

20.functione3 icon 20.functione3

A function is an independent section of code that maps zero or more input parameters to zero or more output parameters.

21.functione4 icon 21.functione4

A function is an independent section of code that maps zero or more input parameters to zero or more output parameters.

22.functione5multiple-variable icon 22.functione5multiple-variable

Functions in Golang can return multiple values, which is a helpful feature in many practical scenarios. This example declares a function with two return values and calls it from a main function.

23.-anonymousfunctions icon 23.-anonymousfunctions

An anonymous function is a function that was declared without any named identifier to refer to it. Anonymous functions can accept inputs and return outputs, just as standard functions do.

25.array1 icon 25.array1

An array is a numbered sequence of elements of a single type with a fixed length.

26.array2 icon 26.array2

This program computes the average of a series of test scores. If you run it you should see 86.6. Let's walk through the program: • First we create an array of length 5 to hold our test scores, then we fill up each element with a grade • Next we setup a for loop to compute the total score • Finally we divide the total score by the number of elements to find the average

3.sub- icon 3.sub-

An example program using two numbers

31.slicefunction icon 31.slicefunction

Go includes two built-in functions to assist with slices: append and copy. Here is an example of append:

32.slicecopy icon 32.slicecopy

After running this program slice1 has [1,2,3] and slice2 has [1,2]. The contents of slice1 are copied into slice2, but since slice2 has room for only two elements only the first two elements of slice1 are copied.

34.arithdemo icon 34.arithdemo

Go supports the same four basic arithmetic operations such as addition, subtraction, multiplication, and division.

35.increment_decrement icon 35.increment_decrement

Go has special syntax for increment and decrement. ++ syntax for increment. a++ means a = a + 1 — syntay for decrement. a— means a = a - 1 For

36.importmath icon 36.importmath

In fmt library, it provides a feature to get input from keyboard. We can use Scanf(). For illustration, we calculate circle area. In this case, we need an input for radius value. Create a folder, called inputdemo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.