Exemplos de programa em cobol
identification division. program-id ola. environment division. configuration section. special-names. decimal-point is comma.
procedure division. display "Hoje começamos a aprender COBOL... que alegria.". stop"". stop run.
PROGRAMA 2
identification division. program-id ola. environment division. configuration section. special-names. decimal-point is comma. working-storage section 77 n1 pic 99. 77 n2 pic 99. 77 escolha pic 99. 77 soma pic 99. 77 sub pic 99. 77 mult pic 99. 77 div pic 99.
procedure division. display "Hoje Vamos calcular:". display "Escolha a operação". display "1-Somar". display "2-Subtrair". display "3-Multiplicar". display "4-Dividir". accept escolha at 0910.
display "Digite dois numeros:" at 1110. accept n1 at 1310. accept n2 at 1510 . if escolha = 1 then perform compute soma = n1 + n2 display "Soma =" at 1710 display soma at 1720 else if escolha = 2 compute sub = n1 - n2 display "Subtracao =" at 1710 display sub at 1720 else if escolha = 3 compute mult = n1 * n2 display "Multiplicacao =" at 1710 display mult at 1728 else if escolha = 4 compute div = n1 / n2 display "Divisão =" at 1710 display div at 1720 end-if. stop"". stop run.
PROGRAMA 3
IDENTIFICATION DIVISION. PROGRAM-ID TesteAula01_Num AUTHOR. Naiara.