برنامه سازی پیشرفته

این وبلاگ جهت ارائه مطالب راجع به کامپیوتر ساخته شده

برنامه سازی پیشرفته

این وبلاگ جهت ارائه مطالب راجع به کامپیوتر ساخته شده

  • ۰
  • ۰

■تمرین اول :

A = int(input(“ please enter A : “)

If A >0 :

   Print(“positive”)

  Elif A<0 :

   Print(“negative”)

Else:

   Print(“zero”)

 

■تمرین دوم :

A = int(input(“ please enter A : “)

B = int(input(“ please enter B : “)

C = int(input(“please enter c : “)

Max = A

If B >A :

   Max = B

If C >B :

   Max = C

Print (“ maximum number is : “ , max )

 

 

■تمرین سوم :

A = int(input(“ please enter A : “)

B = int(input(“ please enter B : “)

C = int(input(“please enter c : “)

Max = B

Mid = 0

Min = A

If A>B :

   Max = A

If c > A :

   Max = C

If B<A :

   Min = B

If C < A :

   Min = C

If min<A<max :

   Mid = A

If min < B <max :

   Mid = B

If min < C <max :

   Mid = C

Print ( max,mid,min )

 

 

■تمرین چهارم :

A = int(input(“ please enter a number between 0 to 9  : “)

If A =9 :

   Print (“nine”)

   Elif A =8 :

      Print(“eight”)

      Elif A = 7 :

         Print (“seven”)

         Elif A = 6 :

            Print(“six”)

            Elif A = 5 :

               Print (“five”)

               Elif A = 4 :

                  Print (“four”)

                  Elif A = 3 :

                     Print (“three”)

                     Elif A = 2 :

                           Print (“two”)

                           Elif A = 1 :

                              Print (“one”)

                            Else:

                               Print (“zero”)

 

 

■تمرین پنجم :

A = int(input(“ please enter A : “)

Print (“ is your number divisible to 2 ? “)

If num % 2 = 0

   Print(“YES”)

   Else :

      Print (“NO”)

 

 

■تمرین ششم :

A = int(input(“ please enter an integer number : “)

If A = 2 :

   Print(“two”)

   Elif A = 3 :

      Print(“three”)

      Elif A = 4 :

         Print (“four”)

         Elif A = 5 :

            Print(“five”)

Else :

   Print(“others”)

 

 

■تمرین هفتم روش اول :

A = int(input(“ please enter A : “)

B = int(input(“ please enter B : “)

A , B = B , A

Print(A , B)

 

■تمرین هفتم روش دوم :

A = int(input(“ please enter A : “)

B = int(input(“ please enter B : “)

A = A+B

B=A-B

A= A-B

Print(A , B)

 

 

■تمرین هشتم :

A = int(input(“ please enter A : “)

Temp =0

Sum =0

T10=0

For A > 0 :

Temp=A//10

A=A%10

Temp=temp*T10

Sum=sum+temp

T10=T10*10

Print(sum)

  • ۰۲/۰۱/۲۵
  • Mohammad sadra Taleb beydokhti

نظرات (۰)

هیچ نظری هنوز ثبت نشده است

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی