Skip to content

Instantly share code, notes, and snippets.

View zrhans's full-sized avatar

Hans Rogério Zimermann zrhans

View GitHub Profile
@zrhans
zrhans / switch_case_with_if_else.py
Created October 17, 2023 02:57 — forked from duducp/switch_case_with_if_else.py
Switch case with if/else
def function1():
print("Case 1 selected")
def function2():
print("Case 2 selected")
def default():
print("Value default")
def switch(case):
@zrhans
zrhans / switch_case_dict_functions.py
Created October 17, 2023 02:57 — forked from duducp/switch_case_dict_functions.py
Switch case using dict functions
def function1():
print("Case 1 selected")
def function2():
print("Case 2 selected")
def default():
print("Value default")
if __name__ == "__main__":
program mainprog
implicit none
real :: a, b
a = 2.0
b = 3.0
Print *, "Antes de chamar troca"
Print *, "a = ", a
Print *, "b = ", b
@zrhans
zrhans / index.html
Created October 15, 2019 02:34 — forked from alyssaq/index.html
HTML5 skeleton template
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>App</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script charset="utf-8" src="js/app.js"></script>
<link rel="stylesheet" href="css/app.css" />
</head>
<body>
program volumes
implicit none
real, parameter :: pi = 3.14159265359
real :: volume = 0.0
integer :: raio
! iterando 10 vezes
open(unit=10, file='volumes.csv', status='unknown')
do raio = 1, 10
!gfortran, gcc version 5.4.0 20160609
program forca_magnetica
real :: B = 1.2 ! [mT]
real :: K = 5.3 ! [MeV]
real :: m = 1.6726219 * 1e-27 !1e-27 ! [Kg]
real :: q = 1.60217662 * 1e-19 ! [C]
real :: v = 0.0
program matrizes
implicit none
!Declarar vars linhas e colunas i,j
integer :: i,j
integer, dimension(3,3) :: ID3
integer, dimension(3,3) :: A !linha1 linha2 linha3
integer, dimension(3,3) :: B = reshape((/3,1,5, 9,1,7, 2,1,0/),(/3,3/))
integer, dimension(3,3) :: C
! Atividade:https://my.pcloud.com/publink/show?code=XZn8R57ZwL98CRSObpY6l3Bb75cirVU9Ky5k
!
program work_3
implicit none ! Adicionado por Hans
integer :: nc, nl, i, j
real,dimension(:,:), allocatable :: matriz
real,dimension(:), allocatable :: maxval1(:)
logical :: exis_arq
!Software para calcular o fatorial de nùmeros inteiros
!Desenvolvido por Denrlei Machado da Silva em 18/11/2017
!Versão 2017
program fatorial1
implicit none
!Declaração das variáveis
real :: a, x
real :: fatorial
! Codigo usado na aula do dia 13-11-2017
program arrays
real :: a(2), b(2), c(2), soma, media
real :: x(3), y(3), maximo(1)
real :: pe, co
a = 0.; b = 0.; c = 0.
x = (/2,4,2/); y = (/1,3,2/)
a = b * c ! produto entre dois arrays