nirneeman1
New member
עזרה בשפת c
אני צריך לכתוב תוכנה פשוטה שמקבלת שני מספרים ונותנת את המספר בעל הערך המוחלט הגדול יותר
#include <stdio.h>
#include <math.h>
int main (void)
{
double firnum, secnum,x,y;
printf ("please type 2 real numbers:");
scanf ("%lf,%lf",&firnum,&secnum);
{
if (firnum<0)
(x=-1*firnum);
else (x=firnum);
{if (secnum>0)
(y=-1*secnum);
else (y=secnum);
}
{
if(x>y)
printf("%lf",firnum);
else
printf("%lf",secnum);
}
return 0;
}
מישהו יודע מה לא בסדר??
אני צריך לכתוב תוכנה פשוטה שמקבלת שני מספרים ונותנת את המספר בעל הערך המוחלט הגדול יותר
#include <stdio.h>
#include <math.h>
int main (void)
{
double firnum, secnum,x,y;
printf ("please type 2 real numbers:");
scanf ("%lf,%lf",&firnum,&secnum);
{
if (firnum<0)
(x=-1*firnum);
else (x=firnum);
{if (secnum>0)
(y=-1*secnum);
else (y=secnum);
}
{
if(x>y)
printf("%lf",firnum);
else
printf("%lf",secnum);
}
return 0;
}
מישהו יודע מה לא בסדר??