SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
UNIVERSIDADE FEDERAL DE MATO GROSSO
CAMPUS UNIVERSITÁRIO DE RONDONÓPOLIS

Instituto de Ciências Exatas e Naturais – ICEN
Bacharelado em Sistemas de Informação

Laboratório de Programação
Prof. Me. Clóvis Júnior
Rondonópolis, 24 de junho de 2013.

Avaliação 1
1) Criar um programa em Pascal para calcular o valor de R:

R=(X2-X1)(N-1) - (Y2-Y1)(N-1)
Observação: N deve ser maior que 5. (Valor=3.5)
program expo;
uses crt;
var x1,x2,y1,y2,r1,r2:real;
n,i:integer;
begin
clrscr; r1:=0; r2:=0;
write('Informe x1:'); readln(x1);
write('Informe x2:'); readln(x2);
write('Informe y1:'); readln(y1);
write('Informe y2:'); readln(y2);
write('Informe n:'); readln(n);
r1:=1; r2:=1;
for i:=1 to n-1 do
begin
r1:=r1*(x2-x1);
r2:=r2*(y2-y1);
end;
write('Resultado=',r1-r2:6:3);
readln;
end.
2) Criar um programa em Pascal para calcular a série apresentada na
ilustração a seguir, nessa série o valor do elemento atual é a soma dos dois
elementos anteriores. A quantidade de elementos gerados deve ser superior a
8, caso contrario o cálculo não deverá ser executado (apresentar uma
mensagem de erro). (Valor=3.5)

program fibo;
uses crt;
var a,i,b,n,c:integer;
begin
clrscr;
a:=1; b:=0; c:=0;
write('Informe o limite maximo:');
readln(n);
for i:=1 to n do
begin
c:=a+b;
a:=b;
b:=c;
write(c,' ');
end;
readln;
end.

3) Criar um algoritmo que leia a idade de uma pessoa e mostre sua classe
eleitoral:
• Não-eleitor (abaixo de 16 anos);
• Eleitor Obrigatório (entre 18 e 65 anos);
• Eleitor facultativo (maior de 65 anos);
Observação: não será aceito valores negativos. (Valor=3.0)
program lista;
uses crt;
var idade:integer;
begin
clrscr;
write('Informe a idade:'); readln(idade);
if (idade>=0) then
if (idade<16) then writeln('Nao-Eleitor')
else
if (idade>=18) and (idade<=65) then writeln('Eleitor
Obrigatorio')
else writeln('Eleitor Facultativo')
else
writeln('Idade negativa');
readln;
end.
UNIVERSIDADE FEDERAL DE MATO GROSSO
CAMPUS UNIVERSITÁRIO DE RONDONÓPOLIS

Instituto de Ciências Exatas e Naturais – ICEN
Bacharelado em Sistemas de Informação

Laboratório de Programação
Prof. Me. Clóvis Júnior
Rondonópolis, 24 de junho de 2013.

Avaliação 2
1) Criar um programa em Pascal para calcular o valor de Y na série a seguir:

(Valor=3.5)

program serie1;
uses crt;
var n,x,i,i2:integer;
soma:real;
sinal:char;
begin
clrscr; soma:=0; sinal:='+';
write('Informe o valor de N:');
readln(n);
write('Informe o denominador:');
readln(x);
i2:=0;
for i:=1 to n do
begin
i2:=i2+2;
if (sinal='+') then
soma:=soma+(i2/x)
else soma:=soma-(i2/x);
end;
writeln('Resultado:',soma:4:2);
readln;
end.
2) Implemente um programa em Pascal para calcular a média aritmética de 10
valores inteiros. Somente será considerado valores impares maiores que 10.
(Valor=3.0)

program media2;
uses crt;
var soma,w,qtde,valor:integer;
begin
clrscr;
for w:=1 to 5 do
begin
write('Informe o valor:'); readln(valor);
if (((valor mod 2)<>0) and (valor>10)) then
begin
soma:=soma+valor;
inc(qtde);
end;
end;
writeln('Media:',soma/qtde:4:2);
readln;
end.
3) Implemente um programa em Pascal para calcular o preço total devido por
um cliente, o programa deve receber o código de um produto, a quantidade
comprada e calcular o preço total, usando a tabela abaixo. Apresente uma
mensagem caso haja código inválido.
Código
'ABCD'
'XYPK'
'KLMP'
'QRST'

Preço
unitário
R$ 5,30
R$ 6,00
R$ 3,20
R$ 2,50

Compras com valores superiores a R$ 100,00 terão desconto de 3% e compras
com superiores a R$ 200,00 terão desconto de 5%. (Valor=3.5)
program valores;
uses crt;
var total:real;
qtde:integer;
codigo:string;
begin
clrscr; total:=0;
write('Informe o Codigo do Produto:'); readln(codigo);
write('Informe a Quantidade:'); readln(qtde);
// Calcula valor da compra
if (codigo='ABCD') then
total:=5.3*qtde
else
if (codigo='XYPK') then
total:=6*qtde
else
if (codigo='KLMP') then
total:=3.2*qtde
else if (codigo='QRST') then
total:=2.5*qtde;
// Calcula desconto
if (total>100) and (total<=200)
then total:=total-(total*0.03)
else
if (total>200) then total:=total-(total*0.05);
write('Resultado=',total:4:2);
readln;
end.

Weitere ähnliche Inhalte

Empfohlen

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Avaliacao1 resolucao

  • 1. UNIVERSIDADE FEDERAL DE MATO GROSSO CAMPUS UNIVERSITÁRIO DE RONDONÓPOLIS Instituto de Ciências Exatas e Naturais – ICEN Bacharelado em Sistemas de Informação Laboratório de Programação Prof. Me. Clóvis Júnior Rondonópolis, 24 de junho de 2013. Avaliação 1 1) Criar um programa em Pascal para calcular o valor de R: R=(X2-X1)(N-1) - (Y2-Y1)(N-1) Observação: N deve ser maior que 5. (Valor=3.5) program expo; uses crt; var x1,x2,y1,y2,r1,r2:real; n,i:integer; begin clrscr; r1:=0; r2:=0; write('Informe x1:'); readln(x1); write('Informe x2:'); readln(x2); write('Informe y1:'); readln(y1); write('Informe y2:'); readln(y2); write('Informe n:'); readln(n); r1:=1; r2:=1; for i:=1 to n-1 do begin r1:=r1*(x2-x1); r2:=r2*(y2-y1); end; write('Resultado=',r1-r2:6:3); readln; end. 2) Criar um programa em Pascal para calcular a série apresentada na ilustração a seguir, nessa série o valor do elemento atual é a soma dos dois elementos anteriores. A quantidade de elementos gerados deve ser superior a
  • 2. 8, caso contrario o cálculo não deverá ser executado (apresentar uma mensagem de erro). (Valor=3.5) program fibo; uses crt; var a,i,b,n,c:integer; begin clrscr; a:=1; b:=0; c:=0; write('Informe o limite maximo:'); readln(n); for i:=1 to n do begin c:=a+b; a:=b; b:=c; write(c,' '); end; readln; end. 3) Criar um algoritmo que leia a idade de uma pessoa e mostre sua classe eleitoral: • Não-eleitor (abaixo de 16 anos); • Eleitor Obrigatório (entre 18 e 65 anos); • Eleitor facultativo (maior de 65 anos); Observação: não será aceito valores negativos. (Valor=3.0) program lista; uses crt; var idade:integer; begin clrscr; write('Informe a idade:'); readln(idade); if (idade>=0) then if (idade<16) then writeln('Nao-Eleitor') else if (idade>=18) and (idade<=65) then writeln('Eleitor Obrigatorio') else writeln('Eleitor Facultativo') else writeln('Idade negativa'); readln; end.
  • 3. UNIVERSIDADE FEDERAL DE MATO GROSSO CAMPUS UNIVERSITÁRIO DE RONDONÓPOLIS Instituto de Ciências Exatas e Naturais – ICEN Bacharelado em Sistemas de Informação Laboratório de Programação Prof. Me. Clóvis Júnior Rondonópolis, 24 de junho de 2013. Avaliação 2 1) Criar um programa em Pascal para calcular o valor de Y na série a seguir: (Valor=3.5) program serie1; uses crt; var n,x,i,i2:integer; soma:real; sinal:char; begin clrscr; soma:=0; sinal:='+'; write('Informe o valor de N:'); readln(n); write('Informe o denominador:'); readln(x); i2:=0; for i:=1 to n do begin i2:=i2+2; if (sinal='+') then soma:=soma+(i2/x) else soma:=soma-(i2/x); end; writeln('Resultado:',soma:4:2); readln; end.
  • 4. 2) Implemente um programa em Pascal para calcular a média aritmética de 10 valores inteiros. Somente será considerado valores impares maiores que 10. (Valor=3.0) program media2; uses crt; var soma,w,qtde,valor:integer; begin clrscr; for w:=1 to 5 do begin write('Informe o valor:'); readln(valor); if (((valor mod 2)<>0) and (valor>10)) then begin soma:=soma+valor; inc(qtde); end; end; writeln('Media:',soma/qtde:4:2); readln; end. 3) Implemente um programa em Pascal para calcular o preço total devido por um cliente, o programa deve receber o código de um produto, a quantidade comprada e calcular o preço total, usando a tabela abaixo. Apresente uma mensagem caso haja código inválido. Código 'ABCD' 'XYPK' 'KLMP' 'QRST' Preço unitário R$ 5,30 R$ 6,00 R$ 3,20 R$ 2,50 Compras com valores superiores a R$ 100,00 terão desconto de 3% e compras com superiores a R$ 200,00 terão desconto de 5%. (Valor=3.5) program valores; uses crt; var total:real; qtde:integer; codigo:string;
  • 5. begin clrscr; total:=0; write('Informe o Codigo do Produto:'); readln(codigo); write('Informe a Quantidade:'); readln(qtde); // Calcula valor da compra if (codigo='ABCD') then total:=5.3*qtde else if (codigo='XYPK') then total:=6*qtde else if (codigo='KLMP') then total:=3.2*qtde else if (codigo='QRST') then total:=2.5*qtde; // Calcula desconto if (total>100) and (total<=200) then total:=total-(total*0.03) else if (total>200) then total:=total-(total*0.05); write('Resultado=',total:4:2); readln; end.