A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/premierconsult/public_html/index.php:65)

Filename: core/Input.php

Line Number: 408

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot send session cookie - headers already sent by (output started at /home/premierconsult/public_html/index.php:65)

Filename: Session/Session.php

Line Number: 143

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/premierconsult/public_html/index.php:65)

Filename: Session/Session.php

Line Number: 143

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/premierconsult/public_html/index.php:65)

Filename: controllers/Questions.php

Line Number: 330

أكتب برنامج باستخدام الدالة go to يطلب من المستخدم رقمين (فترة) و يطبع ضمن شروط

أكتب برنامج باستخدام الدالة go to يطلب من المستخدم رقمين (فترة) و يطبع ضمن شروط


أكتب برنامج باستخدام الدالة to go يطلب من المستخدم رقمين (فترة)  ثم اذا ضغط المستخدم

حرف p يقوم البرنامج بطباعة الأعداد الأولية  في  الفترة المدخلة.

حرف d  يقوم البرنامج بطباعة الأعداد التي تقبل القسمة على (6 ، 4 ، 2 )  ضمن  الفترة المدخلة

حرف s  يقوم البرنامج بجمع الاعداد التي في الفترة المدخلة

 حرف f  يقوم البرنامج بطباعة   مضروب الأعداد  في  الفترة المدخلة

 حرف o  يقوم البرنامج بطباعة   الأعداد الزوجية  في  الفترة المدخلة

  أما إذا أراد المستخدم الخروج من البرنامج يقوم بالضغط على حرف e  

الأجوبة

#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n1,n2,mu=1, sum=0;
char c;
cout<<"enter two numbers";
cin>>n1>>n2;
do{
choice:
cout<<"press leter(p)to print primry 
number"<<endl;
cout<<"press leter(d)to print divisiliy for 
numbers(2-4-6)"<<endl;
cout<<"press leter(s)to print sum 
number"<<endl;
cout<<"press leter(f)to print factors 
number"<<endl;
cout<<"press leter (O) to print oven 
number"<<endl;
cout<<"press leter (e) for exit"<<endl;
cin>>c;
if(c=='f')goto mul;
elseif(c=='s')goto sum;
elseif(c=='p')goto pri;
elseif(c=='d')goto div;
elseif(c=='o')goto ov;
elseif(c=='e')goto exit;
cout<<"bad choice tre agin"<<endl;
goto choice;
pri:
int i,j,f;
for(i=n1;i<n2;i++)
{f=1;
for(j=n1;j<i;j++)
if(i%j==0)
f=0;
if(f==1)
cout<<i<<" ";}
mul:
for(int i=n1;i<=n2;i++)
mu*=i;
cout<<mu<<" ";
goto choice;
sum:for(int i=n1;i<=n2;i++)
sum+=sum;
cout<<sum<<endl;;
goto choice;
div:
for(int i=n1; i<=n2; i++){
if(i%2!=0 )
continue;
elseif(i%4!=0 )
continue;
elseif(i%6!=0 )
continue;
cout<<i<<endl;}
goto choice;
ov:for(int i=n1; i<=n2; i++)
if(i%2==0)
cout<<i<<" "<<endl;
goto choice;
}while(c!='e');
exit:
return 0;
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...