Escolar Documentos
Profissional Documentos
Cultura Documentos
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or
input loop */
int peso,total,i;
total=0;
i=1;
while(i<=25){
i++;
return 0;
}
2-
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or
input loop */
printf("Quantidade ?");
scanf("%d", &q);
printf("preco ?");
scanf("%d", &pr);
i++;
return 0;
}
3-
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or
input loop */
int nh,total,i;
nh=0;
total=0;
i=0;
while (i<30){
total+= nh;
i++;
4-
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or
input loop */
int idade,total,i;
idade=0;
total=0;
i=0;
while (i<=10){
printf("idade ?");
scanf("%d", &idade);
i++;
return 0;
}
5-
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or
input loop */
int nh,total,i,pr;
nh=0;
total=0;
i=0;
pr=0;
while (i<=30){
total+= nh;
pr= 10 *total;
i++;
return 0;
6-
float tc,m,c,f,i;
c=0;f=0;i=0;tc=0;m=0;
while (i<=50){
f++;
c=5*(f-32)/9;
printf("%f \n",c);
tc= tc + c;
i++;
m=tc/50;
return 0;
}
7-
float polvo=1,somadospolvos=0,t=0;
if (polvo > 0 ) {
somadospolvos+=polvo;
t++;
}
8-
float idade=1,altura=0,somaaltura=0,t=0;
while( idade>=0 ) {
if(idade<=0){
continue;
}
9-
int n=1,p=1,soman=0;
while( p <=10 ) {
p++;
printf("%i\n",soman);
10-
int a=1,b=1,area=0;
if(a<=0){
printf("Este programa não pode permitir a entrada de dados inválidos \n");
continue;
}
if(b<=0){
printf("Este programa não pode permitir a entrada de dados inválidos \n");
continue;
}
area= b*a/2;
11-
float a=1,idade,altura,peso,cont50=0,somaltura=0,cont1020=0,contmenor40kg=0;
while( a <= 3 ) {
if(idade>50){
cont50++;
}
if(peso<40){
contmenor40kg++;
}
a++;
}
int p=0;
while(p!=1000) {
if(p%2==0){
printf("O numero e par \n");
printf("\n");
}
else{
printf("O numero e impar \n");
printf("\n");
}
13-
float HT,VT,SL,SB,SB_INSS,I=1;
while(I>0) {
SB=HT*VT;
SB_INSS=SB-(SB*0.11);
if(SB_INSS<900){
printf("Voce esta isento do imposto de renda \n");
printf("o salario liquido: %.2f \n",SB_INSS);
}
else{
SL=SB_INSS-(SB_INSS*0.275);
printf("o salario liquido: %.2f \n",SL);
}
14-
float I=1,PE,Somadacompra=0,SL,parcelas;
int CP;
while(I>0) {
Somadacompra+=PE;
printf("\n");
printf("\n");
}
printf("\n");
printf("Qual a condicao de pagamento :\n");
printf("1- A vista em dinheiro ou cheque, com 10%% de desconto \n");
printf("2- A vista com cartão de crédito, com 5%% de desconto \n");
printf("3- Em 2 vezes, preço normal de etiqueta sem juros \n");
printf("4- Em 3 vezes, preço de etiqueta com acréscimo de 10%% \n");
printf("\n");
switch (CP) {
case 1:
SL=Somadacompra-(Somadacompra*0.1);
printf("O valor a pagar e %.2f \n",SL);
break;
case 2:
SL=Somadacompra-(Somadacompra*0.05);
printf("O valor a pagar e %.2f \n",SL);
break;
case 3:
SL=Somadacompra/2;
printf("O valor a pagar em duas vezes e %.2f \n",SL);
break;
case 4:
SL=(Somadacompra/3)*1.1;
printf("O valor a pagar em tres vezes e %.2f \n",SL);
break;
}
15-
float SAL_NOVO,
SAL=1,VAlGASTODOSAUMENTOS=0,VAlORDASOMADOSSALARIOSSEMAUMENTO=0;
while(SAL>0){
if(SAL<0){
continue;
}
VAlORDASOMADOSSALARIOSSEMAUMENTO+=SAL;
if (SAL<500){
SAL_NOVO= SAL*1.15;
printf("Seu novo salario e %.2f \n",SAL_NOVO);
VAlGASTODOSAUMENTOS+=SAL_NOVO;
}
else{
SAL_NOVO= SAL*1.05;
printf("Seu novo salario e %.2f \n",SAL_NOVO);
VAlGASTODOSAUMENTOS+=SAL_NOVO;
}
}
printf("O valor gasto a mais com os aumentos e %.2f \n", VAlGASTODOSAUMENTOS-
VAlORDASOMADOSSALARIOSSEMAUMENTO);
16-
// R$4 por 1h
// R$6 por 2h
// mais 1 real por hora depois de duas horas
while (h>0) {
printf("Qual a hora de entrada ? \n");
scanf("%f", &HE);
//
if (REST <= 1) {
printf("%.0f reais \n", PAG);
}
else {
for(; REST > 2 ; REST--){
PAG++;
}
printf("%.2f reais \n", PAG+2 );
}
printf("Voce quer calcular outro salario?\n(digite um numero negativo se deseja parrar)\
n");
scanf("%f", &h);
}
17-
int idade,h=1,QC=0,QS=0,QV=0,SidadeV=0,QDS=0;
char estadoCivil[1];
while(h<=20){
printf("\n");
printf("Qual o seu estado civil : \n");
printf("C-casado \n");
printf("S-solteiro \n");
printf("V-viuvo \n");
printf("D-desquitado ou separado \n");
printf("Qual o seu estado civil ? \n");
scanf("%c",&estadoCivil);
printf("\n");
switch (estadoCivil[1]){
case 'C':
QC++;
break;
case 'S':
QS++;
break;
case 'V':
SidadeV+=idade;
QV++;
break;
case 'D':
QDS++;
break;
}
h++;
}
printf("A quantidade de pessoas casadas e %i \n",QC);
printf("A quantidade de pessoas solteiras e %i \n",QS);
printf("A media das idades das pessoas viuvas %i \n",SidadeV/QV);
printf("A porcentagem de pessoas desquitadas ou separadas dentre todas as pessoas
analisadas e %i%%", QDS*5);