Results 1 to 4 of 4
Thread: C++
Hybrid View
-
7th December 2010 18:51 #1
C++
3 (3), N (3<=N<=7) N- , [P;Q]
Code:#include<iostream.h> void Print (int a[],int n) { for (int i=0;i<n;i++) cout<<a[i]; cout<<endl; } int endv(int a[],int n) { for(int i=0;i<n;i++) if(a[n]==0)return 0; return 1; } int main() { int a[7],n,p,q; do { cout<<"n=";cin>>n; } while(n<3 || n>7); cout<<"p="; cin>>p; do { cout<<"q="; cin>>q; } while(q<p); system("pause"); return 0; }
-
7th December 2010 19:16 #2Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
1 - , 816. ?
, .
-
7th December 2010 19:19 #3
816%10=6
816/10=81
81%10=1
81/10=8
6+1+8=15
, .#include<iostream.h>
int main()
{
int number=816,sbor=0,a;
do
{
if(number<10)sbor=sbor+number;
else sbor=sbor+(number%10);
number=number/10;
}
while(number!=0);
cout<<sbor;
system("pause");
return 0;
}Last edited by tanago; 7th December 2010 at 19:40.
-
7th December 2010 20:04 #4Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
- - N- , . , . N 7, .




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in