Baixe o app para aproveitar ainda mais
Prévia do material em texto
2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 1/10 PROVA DISCURSIVA: LINGUAGEM DE PROGRAMAÇÃO Disciplina(s): Linguagem de Programação Data de início: 22/07/2016 17:05 Prazo máximo entrega: 22/07/2016 18:35 Data de entrega: 22/07/2016 18:01 Questão 1/5 Um funcionário de uma empresa recebe aumento salarial anualmente. Sabese que: Esse funcionário foi contratado em 1995, com salario inicial de R$1.000,00; Em 1996 recebeu aumento de 15% sobre o seu salário inicial; A partir de 1997 (inclusive), os aumentos salariais sempre corresponderam ao dobro do percentual do ano anterior. Faça um programa que determine o salário atual desse funcionário. Nota: 6.0 R. #include <stdio.h> #include <math.h> int main(){ double sal=1000,per; int ano,a,cont; printf("Digite o ano atual: "); scanf("%d",&ano); if(ano == 1995) printf("\n\nSalario atual: %.2lf",sal); else if(ano == 1996) DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 2/10 printf("\n\nSalario atual: %.2lf",sal+sal*0.15); else{ cont= ano1996; per=0.15; for (a=1;a<=cont;a++){ per= per*2; //printf(" \n%.2lf",per);dobro do percenti } printf("\n\nSalario atual: %.2lf",sal+sal*per); //printf("\n\n%d",cont);contador } return 0; } Resposta: #include <stdio.h> #include Questão 2/5 Faça um programa que carregue uma matriz 2x2, calcule e mostre uma matriz resultante que será a matriz digitada multiplicada pelo maior elemento da matriz. Nota: 16.0 R. #include <stdio.h> int main(){ int matriz[2][2]; int i,j,maior; DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 3/10 for (j=0;j<2;j++){ for (i=0;i<2;i++){ printf("Insira o numero: "); scanf("%d",&matriz[i][j]); if(maior<matriz[i][j]) maior=matriz[i][j]; } } for (i=0;i<2;i++){ printf("\n\nLinha %d: ",i+1); for (j=0;j<2;j++){ printf(" %d", matriz[i][j]); } } printf("\n\nMaior elemento: %d\n", maior); for (i=0;i<2;i++){ printf(" \nLinha %d: ",i+1); for (j=0;j<2;j++) printf(" %d",(matriz[i][j]*maior)); DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 4/10 } return 0; } Resposta: #include <stdio;h> int main(){ int matriz[2][2]; int i,j, maior; for (j=0;j<2;j++){ for (i=0;i=2;i++){ printf(''Insira o numero :''); scanf(''%d',&matriz[i][j]); if (maior< matriz[i][j]) maior=matriz[i][j]; { } for (i=0;i<2,i++){ printf(''n\nLinha%d:''i+1); for (j=0,j<2;j++){ printf(''%d'',matriz [i][j]); { { prinft(''n\Nmaior Elemento: %d\n'', maior); for (i=0;j<2,i++){ printf(''\nLinha %d: '',i+1); for (j=0;j<2;j++){ printf(''%d. (matriz[i][j]*maior)); { return 0; } Questão 3/5 Faça um programa que carregue uma matriz 10x3 com as notas de dez alunos em três provas. Mostre um relatório com o número do aluno (número da linha) e aprova em que cada aluno obteve menor nota. Ao final do relatório, mostre quantos alunos tiveram menor nota na prova 1, quantos alunos tiveram menor nota na prova 2 e quantos alunos tiveram menor nota na prova 3. Nota: 20.0 R. #include<stdafx.h> #include<stdio.h> #include<stdlib.h> #define MAXL 10//qtd alunos #define MAXC 5 //qtd notas+2 | prova | menor int main() { float mat[MAXL][MAXC], menor, cont; int i, j, val, qtd[3], temp; for (i=0;i<MAXL;i++) for (j=0;j<(MAXC2);j++) scanf("%f",&mat[i][j]); for (i=0;i<MAXL;i++) { val=1; DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 5/10 cont=0; for (j=0;j<MAXC;j++) { switch(j) { case (MAXC2): mat[i][j]=cont+1; break; case (MAXC1): mat[i][j]=menor; break; default: if(val==1) { menor=mat[i][j]; val=0; cont=j; } else { if (mat[i][j]<menor) { menor=mat[i][j]; cont=j; } } } } } qtd[0]=0; qtd[1]=0; qtd[2]=0; for (i=0;i<MAXL;i++) { DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 6/10 printf("\nAluno: %d Menor nota: %.2f ref a prova: %.0f ",i+1, mat[i][MAXC1], mat[i][MAXC 2]); temp=mat[i][MAXC2]; qtd[temp1]++; } printf("\nQuantidade de menores notas Prova 1: %d Prova 2: %d Prova 3: %d",qtd[0], qtd[1], qtd[2]); printf("\n\n"); /*printf("\nMatriz:\n"); for (i=0;i<MAXL;i++) { printf("\n"); for (j=0;j<MAXC;j++) printf("%2.f",mat[i][j]); } printf("\n\n");*/ system("pause"); return 0; } Resposta: #include <stdafx.h> #include <stdio.h> #include <stdlib.h> #define maxl 10 #define maxc 3 int main() { float mat[maxl][maxc],menor, count; int i,j,val,qtd[3],temp; for (i=0;i<maxl;i++) for (j=0;j<maxc2;j++ scanf(%f,&mat[i][j]); for i=0;i<maxl;i++) { val=1; cont=0; for (j=0;j<maxc;j++ { switch(j) { case (maxc): mat[i][j]=cont+1break; case )maxc1: mat[i]=menor;break default: if (val==1) { menor=mat[i][j] val=0 cont=j; { else { if (mat[i][j]<menor { menor=mat[i][j]; cont=j; { { { { qtd[0]=0; qtd[1]=0; qtd[2]=0; for (i=0;i=<maxl,i++) { printf(''nAluno: &d Menornota: % 2f ref a prova : %.of '', i+1, mat[1][maxc1],mat[i] [maxc2]); te,p=mat[1][maxc2]; qtd[temp1]++; printf (''Quantidade de menores notas prova 1: %d Prova 2 %d Prova 3 %d,qtd[0],qtd[1].qtd[2]; printf(''n\n''); system(''pause''); return 0; Questão 4/5 Faça um programa que receba as vendas semanais (de cada mês) de cinco vendedores de uma loja e armazene essas vendas em uma matriz. Calcule e mostre: O total de vendas do mês de cada vendedor; O total de vendas de cada semana (tosos os vendedores juntos); O total de vendas do mês. DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 7/10 Nota: 0.0 R. #include<stdafx.h> #include<stdio.h> #include<stdlib.h> #define MAXL 5 #define MAXC 5// qtd semanas+1 | total do mes do vendedor int main() { int mat[MAXL][MAXC], somasem[MAXC1], total; int i, j; for (i=0;i<MAXL;i++) for (j=0;j<(MAXC1);j++) scanf("%d",&mat[i][j]); /*printf("\nMatriz:\n"); for (i=0;i<MAXL;i++) { printf("\n"); for (j=0;j<MAXC1;j++) printf("%4d",mat[i][j]); } printf("\n");*/ for (i=0;i<MAXL;i++) { mat[i][MAXC1]=0; for (j=0;j<(MAXC1);j++) { mat[i][MAXC1]=mat[i][MAXC1]+mat[i][j]; } DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 8/10 printf("\nO vendedor %d vendeu %d no mes",i+1,mat[i][MAXC1]); } printf("\n"); total=0; for (j=0;j<(MAXC1);j++) { somasem[j]=0; for (i=0;i<MAXL;i++) { somasem[j]=somasem[j]+mat[i][j]; } printf("\nA semana %d fechou com %d vendas",j+1,somasem[j]); total=total+somasem[j]; } printf("\n\nO Total vendido no mes foi %d",total); printf("\n\n"); system("pause"); return 0; } Resposta: Questão 5/5 Um supermercado deseja reajustar os preços de seus produtos usando o seguinte critério: o produto poderá ter seu preço aumentado ou diminuído. Para alterar o preço o produto deve preencher pelo menos um dos requisitos a seguir: Faça um programa que receba o preço atual e a venda mensal média do produto, calcule e mostre o novo preço. Nota: 0.0 R. DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 9/10 #include <stdio.h> int main(){ int vm; float preco; printf("Insira o preco do produto: "); scanf("%f",&preco); printf("Insira a venda media mensal do produto: "); scanf("%d",&vm); if((vm<500)&&(preco<30)) printf("Aumento de 10 por cento: %.2f ", preco*1.10); else{ if((vm>=500)&&(vm<1200)&&(preco>=30)&&(preco<80)) printf("Aumento de 15 por cento: %.2f ",preco*1.15); else if((vm>=1200)&&(preco>=80)) printf("Diminuicao de 20 por cento: %.2f ",precopreco*0.20); else printf("Sem reajuste: %.2f ",preco); } DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar DELL Destacar 2017528 Prova Discursiva lingagem.html file:///C:/Users/DELL/Desktop/Prova%20Discursiva%20lingagem.html 10/10 return 0; } Resposta: Orientações para realização da avaliação. Dicas da coordenação: Tempo máximo: 0 minutos (após o início). Deseja iniciar a prova agora? DELL Destacar DELL Destacar
Compartilhar