The program is in Italian but it's very simple. I ask how many numbers I have to insert in the vector and then you insert them one by one. I then do for loop to check every number that's been inserted but it doesn't seem work. Anyone know why?
#include <stdio.h>
int main(int argc, const char *argv[])
{
int vett[30];
int n, i;
int conf;
int n2;
do
{
printf("quanti numeri");
scanf("%d", &n);
} while (n <= 0);
for (i = 0; i < n; i++)
{
printf("inserire numero:");
scanf("%d", &vett[i]);
}
printf("inserire secondo numero");
scanf("%d, &n2");
conf = 0;
for (i = 0; i < n; i++)
{
if (vett[i] == n2)
{
conf = 1;
}
}
if (conf == 1)
{
printf("il numero e' contenuto nel vettore");
}
else if (conf == 0)
{
printf("il numero non e' contenuto nel vettore");
}
return 0;
}