Skip to content

Instantly share code, notes, and snippets.

@FelipeGrijo
Created February 24, 2017 20:27
Show Gist options
  • Save FelipeGrijo/24dc43b8d60fb87351cbca172fbe76c5 to your computer and use it in GitHub Desktop.
Save FelipeGrijo/24dc43b8d60fb87351cbca172fbe76c5 to your computer and use it in GitHub Desktop.
10) Entrar com um número e informar se ele é divisível por 10, ou é divisível por 5, ou é divisível por 2 ou se não é divisível por nenhum destes.
//https://gist.github.com/FelipeGrijo
#include <stdio.h>
int main()
{
int Num=0;
printf("Exercicio 10\nDigite um numero:");
scanf("%d",&Num);
if(Num % 10 == 0){
printf("%d e divisivel por 10.\n",Num);
}
else if(Num % 5 == 0){
printf("%d e divisivel por 5.\n",Num);
}
else if(Num % 2 == 0){
printf("%d e divisivel por 2.\n",Num);
}
else
{
printf("%d nao e divisivel por 10, 5 ou 2.\n",Num);
}
system("pause");
return 0;
}
@lazarok09
Copy link

Em PHP seguindo a linguagem HTML.

<title>exercicio2</title> Primeiro Numero:
	 Clique no S para saber se é disiviel por 10, 5 e 2<input type="submit" name="operacao" value="s"> 
// parte do 10 // if( !empty($op) ) { if($op == 's')

if($a % 10 == 0){
echo " é divisivel por 10" ;
}
else { echo " não é divisivel por 10 "; }

}
// parte do 5 //

if( !empty($op) ) {
  if($op == 's')

if($a % 5 == 0){
echo " é divisivel por 5" ;
}
else { echo " não é divisivel por 5 "; }

}

// parte do 2 //
if( !empty($op) ) {
  if($op == 's')

if($a % 2 == 0){
echo " é divisivel por 2" ;
}
else { echo " não é divisivel por 2 "; }

}

// programa escrito por Lázaro José - D.Sistemas-ETE 2018
?>

@joaojp900
Copy link

LINDO meu parceiro dps da etec fez oq?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment