Jump to content

Multiplos de 4 entre n1 e n2


tuasite

Recommended Posts

Boas amigos foi me pedido para fazer estes programa: Desenvolva um algoritmo que leia dois numeros inteiros (n1 e n2) e que mostre e que mostre

todos os numeros entre n1 e n2 que sejam multiplos de 4.

Eu fiz o seguinte codigo mas nao funciona:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,n1,n2,aux;
printf("Digite dois numeros:\n");
scanf("%d""%d",&n1,n2);
if (n2>n1)
{
aux=n1;
n1=n2;
n2=aux;
}
for (i=n1;i<=n2;i++)
if (i%4==0)
printf("%d ",i);
return 0;
}

Obrigado amigos

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.