0% found this document useful (0 votes)
5 views2 pages

C++ Number Input and Processing Programs

The document contains multiple C++ code snippets that perform different tasks, including calculating the product of digits in a number, printing multiples of 5 within a range, and counting positive and negative numbers from user input. It also includes a final program that prints a pattern of numbers based on user input. Each code snippet is structured with input prompts and loops to achieve its respective functionality.

Uploaded by

vlad prangati
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

C++ Number Input and Processing Programs

The document contains multiple C++ code snippets that perform different tasks, including calculating the product of digits in a number, printing multiples of 5 within a range, and counting positive and negative numbers from user input. It also includes a final program that prints a pattern of numbers based on user input. Each code snippet is structured with input prompts and loops to achieve its respective functionality.

Uploaded by

vlad prangati
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

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