Buscar

Lista 2 AEDS I estruturas de repetição

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

Algoritimos/Exercicio 1.c
#include <stdio.h>
#include <stdlib.h>
 main ()
 {
 	float x, y, z;
 	
	printf("ESCREVA O PRIMEIRO VALOR: \n");
 	scanf ("%f", &x);
 	printf("ESCREVA O SEGUNDO VALOR: \n");
 	scanf ("%f", &y);
 	
	 while (y == 0)
	 {
	 	 printf("ESCREVA UM VALOR DIFERENTE DE 0 \n");
	 	 getch();
	 }
		 z = x/y;
 
 	printf("RESULTADO IGUAL A: %f\n", z);
 	
	system("pause");
 	return(0);
 	getch (); 	
 }
Algoritimos/Exercicio 1.exe
Algoritimos/Exercicio 10.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int x=101;
	do
	{
		printf("%d\n",x);
		x++;
	}
	while(x<=110);
	
	getch();
	system("pause");
	}
Algoritimos/Exercicio 10.exe
Algoritimos/Exercicio 11.c
#include <stdio.h>
#include<stdlib.h>
int main() 
 { 
 int x, n; 
 printf ("Digite um numero: \n"); 
 scanf ("%d", &n); 
 while (n <= 1) 
 { 
 printf ("Digite um numero maior que um: \n"); 
 scanf ("%d", &n); 
 } 
 for (x=1; x<=n; x++) 
 { 
 printf (" % d ", x); 
 } 
 getch();
 system("pause"); 
 } 
 
Algoritimos/Exercicio 11.exe
Algoritimos/Exercicio 12.c
#include <stdio.h>
#include <stdlib.h>
int main ()
{
	int x, y;
	printf("Digite uma tabuada: ");
	scanf("%d",&y);
	
	for(x=1; x<=10; x++)
	{
		printf("%dx%d=%d\n",y,x,x*y);
	}
	getch();
	return(0);
	system("pause");
}
Algoritimos/Exercicio 12.exe
Algoritimos/Exercicio 13.c
#include <stdio.h>
#include <stdlib.h>
int main ()
{
	int x, y;
	printf("Digite uma tabuada entre 1 e 10: ");
	scanf("%d",&y);
	
	while(y<1||y>10)
	{
		printf("Digite uma tabuada entre 1 e 10: ");
		scanf("%d",&y);
	}
	for(x=1; x<=10; x++)
	printf("%dx%d=%d\n",y,x,x*y);
	
	getch();
	return(0);
	system("pause");
}
Algoritimos/Exercicio 13.exe
Algoritimos/Exercicio 14.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int a=0, b, c;
	for(b=0; b<10; b++)
	{
		scanf("%d",&c);
		if(c<0)
		{
			a++;
		}
	}
	printf("Resultado dos numeros negativos: %d",a);
	
	getch ();
	system("pause");
	
}
Algoritimos/Exercicio 14.exe
Algoritimos/Exercicio 15.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int a, i; 
	float n, s;
 
	printf ("Digite o numero de alunos: ");
	scanf ("%d", &a);
	
		s =0.0;
	
	for (i=0; i<a; i++)
	{
		printf ("Digite as notas dos alunos ");
	 scanf ("%f" ,&n);
	 s = s + n;
	}
	
	printf("A media das notas dos alunos e: %f",s/a);
	
	getch();
	system("pause");
	}
Algoritimos/Exercicio 15.exe
Algoritimos/Exercicio 16.c
#include <stdio.h>
int main ()
{
	int x, y=0, z;
	for(x=0; x<10; x++)
	{
		printf("Digite um numero: ");
		scanf("%d",&z);
		
		if (z<40)
		{
			y=y+x;
		}
	}
	printf("Resultado da soma dos numeiros inteiros ate 40: %d",soma);
	
	system(pause);
}
Algoritimos/Exercicio 16.exe
Algoritimos/Exercicio 17.exe
Algoritimos/Exercicio 18.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int hab; 
	int i=0;
	int f;
	float sf;
	float sa;
	float ss;
	
	printf("Digite o numero de habitantes: ");
	scanf("%i",&hab);
	
	
		for(i=0; i<hab; i++)
		
		{
			 printf("\n Digite o valor do salario: ");
		 scanf("%f",&sa);
		 
			 ss = ss + sa;
	
		 printf("Digite O numero de filhos: ");
		 scanf("%d",&f);
		 
			sf = sf + f;
		}
		
			printf("A MEDIA DE FILHOS POR PESSOA E: %f" ,sf/hab );
	 printf("O VALOR MEDIO DO SALAIO E: %f" ,ss/hab);
	
	getch();
	system("pause");
}
Algoritimos/Exercicio 18.exe
Algoritimos/Exercicio 19.c
#include<stdlib.h>
int main ()
{
 int c =0;
 while(c<=9)
	{
 ++c;
 printf("%i, 1 2 3 4 5 6 7 8 9 10\n",c);
 }
 getch();
 system ("pause");
}
Algoritimos/Exercicio 19.exe
Algoritimos/Exercicio 2.c
#include <stdio.h>
#include<stdlib.h> 
int main()
{
 float x, y;
 
 printf ("Digite um numero: \n");
 scanf ("%f", &x);
 
 do 
 
 { 
 printf ("Digite um numero diferente de zero: \n");
 scanf ("%f", &y);
 } while (y==0);
 
 printf ("Resultado da divisao: \n%f",x/y);
 
 system("pause"); 
 getch();
}
Algoritimos/Exercicio 2.exe
Algoritimos/Exercicio 3.c
#include <stdio.h> 
int main()
{
	int x;
	
	for(x=1; x<11; x++)
	{
		printf("%d\n",x);
	}
	
	getch();
	return(0);
	system("pause");
}
Algoritimos/Exercicio 3.exe
Algoritimos/Exercicio 4.c
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int x=1;
	do
	{
		printf("%d\n",x);
		x++;
	}while(x<=10);
	
	getch();
	system("pause");
}
Algoritimos/Exercicio 4.exe
Algoritimos/Exercicio 5.c
#include <stdio.h> 
int main()
{
	int x;
	
	for(x=10; x>0; x=x-1)
	{
		printf("%d\n",x);
	}
	
	getch();
	system("pause");
}
Algoritimos/Exercicio 5.exe
Algoritimos/Exercicio 6.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
 int x;
 x=10;
 
	do
 
	{ 
 printf (" % d ", x);
 x--;
 } 
 
	while (x>=1);
 
 getch();
 system("pause");
}
Algoritimos/Exercicio 6.exe
Algoritimos/Exercicio 7.c
#include <stdio.h> 
int main()
{
	int x;
	
	for(x=100; x<111; x++)
	{
		printf("%d\n",x);
	}
	
	getch();
	system("pause");
}
Algoritimos/Exercicio 7.exe
Algoritimos/Exercicio 8.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int x=101;
	
	while (x<=110)
	{
		printf("%d\n",x);
		x++;
	}
	getch();
	system("pause");
	}
Algoritimos/Exercicio 8.exe
Algoritimos/Exercicio 9.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int x=101;
	
	while (x<=110)
	{
		printf("%d\n",x);
		x++;
	}
	getch();
	system("pause");
	}
Algoritimos/Exercicio 9.exe

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Outros materiais