Skip to content

Instantly share code, notes, and snippets.

@paolorotolo
Created December 1, 2016 10:34
Show Gist options
  • Save paolorotolo/f5ad2d04f34c80a63874bfeb164ab7e9 to your computer and use it in GitHub Desktop.
Save paolorotolo/f5ad2d04f34c80a63874bfeb164ab7e9 to your computer and use it in GitHub Desktop.
numeroSoci = input('Quanto soci vuoi inserire?')
for i=1:numeroSoci
socio(i).nome= input('nome: ', 's')
socio(i).cognome=input('cognome: ', 's')
socio(i).cf=input('cf: ', 's')
socio(i).qs=input('qs: ', 's')
socio(i).ruolo=input('ruolo (AMM 1 - CONS 2 - SOCIO 3): ')
end
caricheSpeciali = 0;
for i=1:numeroSoci
if socio(i).ruolo == 3
else
caricheSpeciali=caricheSpeciali+1
end
end
disp(percentuale(caricheSpeciali, numeroSoci))
function a = percentuale(cariche, soci)
a = (cariche*100)/soci
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment