This is not the document you are looking for? Use the search form below to find more!

Report home > Education

lista 2 prog ju

0.00 (0 votes)
Document Description
lista 2 prog ju
File Details
Submitter
  • Name: felicio gomes
Embed Code:

Add New Comment




Related Documents

Plan de Trabajo - Elecciones Isaca 2011 - Lista 2

by: svelando, 22 pages

Detalle del plan de trabajo propuesto por la Lista 2 para las elecciones 2011 en Isaca Perú.

Lista II de calculo

by: Luiz Hemerly, 2 pages

Lista 2 de Calculo(limites)

Lista de inscrições do 2º Sorteio do Blog Esmaltinhos

by: Kiu esmaltinhos, 57 pages

Lista de Inscrições pro Sorteio do Blog Esmaltinhos.Blogspot

Lista de Inscrições no 2º Sorteio do Blog Esmaltinhos

by: Kiu esmaltinhos, 44 pages

Lista de Inscrições no 2º Sorteio do Blog Esmaltinhos

USB PIC PROG 2

by: jungard, 2 pages

USB PIC PROG 2

prog mate 2

by: a, 1 pages

prog mate 2

The Opposite Associations of Lycopene and Body Fat Mass with Humoral Immunity in Type 2 Diabetes Mellitus : A Possible Role in Atherogenesis

by: shinta, 9 pages

This study examined the possible effects of lycopene at physiological dosage and body fat mass on the humoral immune response in patients with type 2 diabetes mellitus (T2DM). A total of ...

The effect of Extend Bar - containing uncooked cornstarch on night-time glycemic excursion in suspects with type 2 diabetes

by: shinta, 4 pages

The objective of this study was to determine the effects of ingesting a snack bar containing uncooked cornstarch (Extend Bar?, Clinical Products, Limited, Key Biscayne, FL) on nocturnal ...

Exploring Effects of Type 2 Diabetes on Cognitive Functioning in Older Adults

by: shinta, 9 pages

Type 2 diabetes may be associated with exacerbated aging-related declines in cognitive neuropsychological performance. The authors examined whether such effects are systematic (i.e., broadly ...

Term 2 Business Revision Sheet

by: Yacoob Mansoor, 7 pages

Term 2 Business Revision Sheet

Content Preview
1
#include <iostream>
using namespace std;
void maior (int n, int &maior1, int &maior2)
{
int num[n];
for (int i =0; i <n; i++)
{
cout << "Digite o " << i+1 << " numero: ";
cin >> num[i];
if (num[i]<0)
{
cout << "numero invalido, repita operacao!!\n";
i--;
}
}
maior1=num[0];
int i,max = 0;
for ( i =0; i <n; i++)
{
if (maior1 < num[i])
{
maior1=num[i];
max = i;
}
} num[max]=0;
maior2=0;
for (i =0; i <n; i++)
{
if (maior2<num[i])
maior2=num[i];
}
}
int main ()
{
int n, validar = 0, maior1, maior2;
do
{
cout << "Quantidade de numeros a serem digitados: ";
cin >> n;
if (n<=0)
{
cout << "INVALIDO!\n";
validar = 0;
}
else
validar = 1;
} while (!validar);
maior (n, maior1, maior2);
cout << "Maior numero digitado: "<<maior1 << ". Segundo maior digitado: " << maior2;
}


2
#include <iostream>
using namespace std;
bool mostraPA (int r)
{
int a=0, i=0;
cout << "15 primeiros termos da PA: ";
while (i<15)
{
a=a+r;
cout<<a<<" ";
i++;
}
}
bool mostraPG (int q)
{
int b=1,i=0;
cout << "15 primeiros termos da PG: ";
while(i<15)
{
b=b*q;
cout<<b<<" ";
i++;
}
}
int main ()
{
int r, q;
char p;
cout << "Complete para saber PA ou PG: P";
cin >> p;
if(p == 'A')
{
cout << "Digite o valor da razao: ";
cin >> r;
mostraPA(r);
}
else if (p == 'G')
{
cout << "Digite o valor da razao: ";
cin >> q;
mostraPG(q);
}
}

3
#include <iostream>
using namespace std;
int main ()
{
int i, vet[10], val=0;
for (i=0; i<10; i++)

{
cout<< "Digite o " << i+1 << " numero: ";
cin >> vet[i];
}
for (i=0; i<10; i++)
{
if(vet[i]<21 && vet[i]>9)
{
val=val++;
}
} cout << "Valores no intervalo [10,20]: " << val << endl;
cout << "Valores fora do intevalo [10,20]: " << 10-val;
}

4
#include <iostream>
using namespace std;
bool verificaPrimo (int n)
{
int cont=0;
for (int i=1; i<n; i++)
{
if ((n%i) == 0)
cont++;
}
if(cont == 1)
return true;
else
return false;
}
int main ()
{
int n;
cout << "Digite o valor e descubra se ele e primo ou nao: ";
cin >> n;

if(verificaPrimo(n)==true)
cout << "Numero digitado e primo!";
else
cout << "Numero digitado nao e primo!";
}

5
#include <iostream>
using namespace std;
int main ()
{
int C;
cout << "Digite a temperatura em graus Celsius: ";
cin >> C;
cout << "A temperatura em Fahrenheit e: " << (9*(C)/5)+32;
cout << "\nTEBELA\n";


for (int f=50; f<=150; f++)
{
cout << f << "F = " << 5*(f-32)/9 << "C\n";
}
}

6
#include <iostream>
using namespace std;
bool funcao ()
{
int i, n, p, ne;
cout << "Digite o valor de i e o de n: ";
cin >> i >> n;
//positivo
for (int a=1; a<n; a++)
{
p=p+i*a;
a++;
}
//negativo
for (int a=2; a<n; a++)
{
ne=ne+i*a;
a++;
}
cout << "Resultado = " << p-ne;
}
int main ()
{
funcao();
}

7
#include <iostream>
using namespace std;
int main()
{
int n, soma=0, menor, divid=0;
cout << "Digite os valores para saber a media e finalize com um numero negativo:\n";

while (n>=0)
{
cin >> n;
divid=divid+1;
soma=soma+n;
menor = n;
}
soma=soma-n;
divid=divid-1;
cout << soma << "/" << divid << " = " << soma/divid;

}

8

#include <iostream>
using namespace std;
float pow( int b , int e ){
int res=1;
if (e==0)
return 1;
else {
for (int i=0;i<e;i++){
res=res*b;}
return res;
}
}
float fat (int n){
int r=1;
if(n==1 ||n==0)
return 1;
else {
for(int i=1;i<=n;i++){
r=r*i;
}
}
return r;
}
int main(){
int i,n;
float r=0;
cout<<"Digite dois numeros:";
cin>>i>>n;
for(int j=1;j <=n;j++){
r=r+pow(i,j)/fat(j);}
cout<<"O resultado e "<<r;
return 0;
}


9
#include <iostream>
using namespace std;
int main()
{
int a, b, par=0, impar=0;
cout << "Digite o primeiro e o ultimo numore do intevalo: ";
cin >> a >> b;
if(a>b)
{cout << "INVALIDO!"; return 0;}
cout << "Intervalo: ";
for(int i=0;i<b;i++)
{

cout << a+i << " ";
if((a+i)%2 == 0)
par=par+(a+i);
else if((a+i)%2 != 0)
impar=impar+(a+i);
}cout << "\nSoma dos pares = " << par << "\nSubtracao dos impares = " << (impar)*-1;
}

10
#include <iostream>
using namespace std;
bool verificaPrimo (int i)
{
if (i==1)
return false;
for (int j=2; j<i; j++)
{
if (i%j==0)
return false;
}
return true;
}
float somaPrimo(int n)
{
int soma=0, i=1;
while (i<=n)
{
if (verificaPrimo (i)== true)
soma=soma + i ;
i++;
}
return soma;
}
int main()
{
int n;
cout<<"Entre com um valor:"<<endl;
cin>>n;
if (n<=2)
cout<<"O valor de n deve ser maior ou igual a dois!"<<endl;
else
cout<<"Soma dos numeros primos igual a: "<< somaPrimo (n)<<endl;
return 0;
}


Download
lista 2 prog ju

 

 

Your download will begin in a moment.
If it doesn't, click here to try again.

Share lista 2 prog ju to:

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share lista 2 prog ju as:

From:

To:

Share lista 2 prog ju.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

loading

Share lista 2 prog ju as:

Copy html code above and paste to your web page.

loading