HELP

hello i have a problem with a programm i made
the programm is the folowing.when i run it , it is always making tha first selection.
where is the mistake???
thank you


#include <stdio.h>

main ()

{

int a,b,name;

printf(“for square write 1\n”);
printf(“for reclangle write 2\n”);
printf(“selection: \n”);
scanf(“%d”,&name);

if(name=1)
{
printf(“give side: \n”);
scanf(“%d”,&a);
printf(“the surface of the square with
side %d is %d”,a, aa);
}

else if(name=2)
{
printf(“give sides: \n”);
scanf(“%d%d”,&a,&b);
printf(“the surface of the rectanglwith sides %d and %d is %d”,a,b,a
b);
}

}

Not quite related to Tamino? :rolleyes:

I’d recommend that you go and read about “error checking” in programs. Google groups is good for programming language questions.

It’s the logical operator. You want to change them to
if (name==1)
and
else if (name==2)