Hello, i tried do some excerises from a book i have, one exercise says to create a program tha you will enter 3 numbers and it will print the biggest and then the 2s biggest and the 3th biggest
for example if you add 8 9 1 it should print
8
9
1
so i did this:
Code:
#include <stdio.h>
main()
{
int ga, ga2, ga3;
printf("Write 3 numbers: \n");
scanf("%i %i %i", &ga, &ga2, &ga3);
if (ga> ga2 > ga3)
{
printf("The numbers are: %i %i %i\n", ga, ga2, ga3);
}
if (ga3 > ga2 > ga)
{
printf("The numbers are: %i %i %i\n", ga3, ga2, ga);
}
if (ga < ga2 <ga3)
{
printf("The numbers are: %i %i %i\n", ga2, ga, ga3);
}
}
but it doesn't work
in the same book i also got an exercise to create a program that when you insert a number betwwen 1 - 7 it will print the days of the week, i could do that by easy with case and swtch but it need if-else
so i did this:
Code:
#include <stdio.h>
/* Apo askisi 6 selida 81*/
main()
{
int numb;
printf("Write a number: \n");
scanf("%d", &numb);
if (numb = '1')
{
printf("Deutera\n");/*means monday*/
}
else
{
if(numb = '2')
{
printf("Triti\n");/*means thirday*/
}
}
else
{
if(numb = '3')
{
printf("Tetarti\n");/*means thirsday*/
}
}
else
{
if(numb = '4')
{
printf("Pempti\n");/*means thusday*/
}
}
else
{
if(numb = '5')
{
printf("Paraskeui\n");/*means friday*/
}
}
else
{
if(numb = '6')
{
printf("Sabbato\n");/*means saturday*/
}
}
else
{
{
if(numb = '6')
{
printf("Kiriaki\n");/*means sunday*/
}
}
}
doens't work thoyght
please help me