0% found this document useful (0 votes)
5 views

Do While

Uploaded by

vlad prangati
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Do While

Uploaded by

vlad prangati
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

#include <iostream>//ex 1

using namespace std;

int main()//234
{ int a,b,c=1,d=0;
cout<<"Introduceti nr de cifre din numar:";
cin>>a;cout<<"Introduceti numarul:";
cin>>b;
do{

c=c*(b%10);
b=b/10;
d++;
}while(d<a);

cout<<"Prod
return 0;
}
2.
#include <iostream>

using namespace std;//2

int main()
{int a,b,c,d=0;
cout<<"Introduceti numerele:";
cin>>a>>c;
b=a;
do{
if (b%5==0) cout<<b<<" "<<endl;
b++;
}
while (b<=c);

return 0;
}
4.

#include <iostream>//4

using namespace std;

int main()
{ int a,b,c; int pz=0,ng=0;
cout<<"Introdu numarele:";
cin>>a;
c=0;
do

{c++;
cout<<"Introdu numarul:"<<c<<endl;
cin>>b;
if (b>=0) pz++;
else ng++;
}while(c<a);
cout<<"Numarul de valori pozitive este:"<<pz<<endl;
cout<<"Numarul de valori negative este:"<<ng;

return 0;
}

programul care trebuie

#include <iostream>
using namespace std;

int main()
{int a,b,c;
cout<<"Introdu n: ";
cin>>c;

for(a=1;a<=c;a++)
{
for(b=1;b<=a;b++)
{
cout<<b<<"";
}
cout<<endl;
}
return 0;
}

You might also like