مشكور خيو
بس انا طالبتها ب do while مو ب for
لاننا ما اخدنا for
الاله مالقيتها للاسف
وشكورا مره ثانيه
|
معليش
هذا الكود
كود:
#include<stdio.h>
#include <math.h>
main ()
{ int a,i;
int s=0;
int s1=0;
printf("Enter integer number ");
scanf("%d",&a);
i=1;
do
{
if (i%2==0)
{s=pow(i,2);
printf("+%.d",s);}
else
{s1=i;
printf("+%d",s1);}
i++;
}while(i<=a);
return(0);
}
وهذي الالة الحاسبة من حل بشبشانه
]أتمنى أنه يكون الحل
كود:
#include<stdio.h>
int main()
{double x,y,z;
int x1,y1,A;
char a;
do
{
printf("Enter first num");
scanf("%lf",&x);
printf("Enter second num");
scanf("%lf",&y);
printf("Enter the operation+,-,*,/\t");
scanf(" %c",&a);
switch(a)
{
case '+':z=x+y;
printf("%f+%f=%f",x,y,z);
break;
case '-':z=x-y;
printf("%f-%f=%f",x,y,z);
break;
case '*':z=x*y;
printf("%f*%f=%f",x,y,z);
break;
case '/':
if(y==0){
printf("cann't calculate");}
else
{z=x/y;
printf("%f/%f=%f",x,y,z);}
break;
case '%':
x1=x;
y1=y;
z=(x1)%(y1);
printf("%dmod(%d)=%f",x1,y1,z);
break;
default:printf("cann't calculate");
break;
}
printf("\nto calculate press 1\n");
scanf("%d",&A);
}while(A==1);
return(0);
}