اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

أرجو ان ينال اعجابكم عذا الكود الذي يظهر فيه أول قاسم لعدد غير أولي

Sub subprim()
Dim y As Double
Dim z As Variant
Dim x As Double
x = Cells(1, 4)
    Range("a3:z3").ClearContents
    Range("a4:z4").ClearContents
    Cells(8, 10).Clear
    Cells(9, 10).Clear
             Cells(8, 10).Font.Size = 20
             Cells(8, 10).Font.Bold = True
             Cells(8, 10).Font.ColorIndex = 3
             
             Cells(9, 10).Font.Size = 20
             Cells(9, 10).Font.Bold = True
             Cells(9, 10).Font.ColorIndex = 3
                                    
If x = 1 Then
     Cells(8, 10).Value = "1 is the first  PRIME number"
          Cells(4, 1) = 1
          Cells(4, 2) = x
         GoTo l1
    ElseIf x = 2 Then
          Cells(4, 1) = 1
          Cells(4, 2) = x
         Cells(8, 10).Value = "2 is the unique even  PRIME number"
        GoTo l2
    ElseIf x <= 0 Then
      Cells(8, 10).Value = "Give me a number greater than 2"
          Cells(4, 1) = x
          Cells(4, 2) = "!!!??."
              GoTo l3
    ElseIf Int(x / 2) = x / 2 Then
      GoTo l6
End If
z = Int(x ^ 0.5) + 1
 For i = 3 To z
 Cells(3, 3).Value = i
     m = x / i - Int(x / i)
    If m = 0 Then
     Cells(4, 1) = i
     Cells(4, 2) = x / i
        Cells(8, 10).Value = "the number " & x & " is NOT  PRIME " & "its = " & i & "." & x / i
        Cells(9, 10).Value = "the first divisor of " & x & "  is  " & i
                    
    GoTo l4
         End If
           Next i
          ' Range("(2,2):2,i").Value = ""
          Cells(8, 10).Value = "the number " & x & " is  PRIME " & "its = " & x & ".1"
          Cells(4, 1) = 1
          Cells(4, 2) = x
   GoTo l5
l1:
 MsgBox "choise a number >1"
  Cells(6, 1).Value = "1 is the first  PRIME number"
GoTo ending
l2:
 MsgBox "2 is the unique  PRIME number"
  Cells(6, 1).Value = "2 is the unique  PRIME EVEN number"
  GoTo ending
l3:
 MsgBox "choose a positiv number"
 Cells(6, 1).Value = "choose a positiv number"
  GoTo ending
l4:
 MsgBox "your number is NOT  PRIME"
 Cells(6, 1).Value = x & " NOT  PRIME"
   GoTo ending
l5:
 MsgBox "your number " & x & " is  PRIME"
 Cells(6, 1).Value = "Bravo!!your number " & x & " is   PRIME"
 GoTo ending
l6:
 MsgBox "your number " & x & " is not  PRIME because it is even"
 Cells(6, 1).Value = "your number " & x & " is NOT PRIME because it is even"
      GoTo ending
ending:
End Sub


قام بنشر

أخي الحبيب

أفتح صفحة الكود عن طريق الضغط على Alt+F11

اضغط كليك يمين على المديول المكتوب به الكود

سوف تظهر لك قائمة اختر منها Export File
واختر مكان الحفظ للمديول

وللاستراج مره اخري
اضغط كليك يمين مرة اخري  واخترImport File  

 

 

انشئ حساب جديد او قم بتسجيل دخولك لتتمكن من اضافه تعليق جديد

يجب ان تكون عضوا لدينا لتتمكن من التعليق

انشئ حساب جديد

سجل حسابك الجديد لدينا في الموقع بمنتهي السهوله .

سجل حساب جديد

تسجيل دخول

هل تمتلك حساب بالفعل ؟ سجل دخولك من هنا.

سجل دخولك الان
  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information