Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Laboratorio di Programmazione
LabPubblico
Commits
f2d61d00
Verified
Commit
f2d61d00
authored
Oct 24, 2019
by
Andrea Trentini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lab 24 ottobre
parent
c73442c3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
atrent/2019-10-24/esercizio.go
atrent/2019-10-24/esercizio.go
+18
-0
atrent/2019-10-24/input
atrent/2019-10-24/input
+1
-0
atrent/2019-10-24/voto_valido.go
atrent/2019-10-24/voto_valido.go
+18
-0
No files found.
atrent/2019-10-24/esercizio.go
0 → 100644
View file @
f2d61d00
package
main
import
"fmt"
/* TRASFORMARLO in un programma che entra in ciclo e legge numeri da stdin fino all'inserimento di un NON-numero e stampa pari/dispari per ogni numero inserito
*/
func
main
()
{
var
num1
int
fmt
.
Print
(
"inserisci un numero: "
)
fmt
.
Scanf
(
"%d
\n
"
,
&
num1
)
//fmt.Scan(&num1)
if
(
num1
%
2
)
==
0
{
fmt
.
Println
(
"pari"
)
}
else
{
fmt
.
Println
(
"dispari"
)
}
//fmt.Printf("%c\n", num1) //Output
}
atrent/2019-10-24/input
0 → 100644
View file @
f2d61d00
7
atrent/2019-10-24/voto_valido.go
0 → 100644
View file @
f2d61d00
// soluzione caricata su upload e discussa in aula
package
main
import
"fmt"
func
main
()
{
var
voto
,
i
int
for
i
<=
0
{
fmt
.
Print
(
"inserisci voto"
)
fmt
.
Scan
(
&
voto
)
if
voto
<
0
||
voto
>
30
{
fmt
.
Println
(
"reinserisci numero"
)
}
else
{
i
=
1
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment