RSS

Numerele divizibile cu 3

09 Apr

Considerăm un şir de n numere întregi …Algoritmul următor afişează toate numerele din şir  care sunt divizibile cu 3.

#include<iostream.h>
#include<conio.h>
int main()
{ int n,i,v[50];
 cout<<"n= "; cin>>n;
 for(i=0;i<n;i++)
 { cout<<"v["<<i<<"]=";
 cin>>v[i]; }
 cout<<"Numerele divizibile cu 3 sunt: ";
 for(i=0;i<n;i++)
 if(v[i]%3==0)
 cout<<v[i]<<"  ";
 getch(); }
About these ads
 
Leave a comment

Posted by on April 9, 2011 in Uncategorized

 

Tags: ,

Lasă un comentariu

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: