You are on page 1of 2

III.

1.

void patrate(int x, int y)


{
int gasit=0,s=0,d;

while(x<=y)
{
for(d=1;d<=9;d++)
if(x%d==0)
if(x/d==d)
{
gasit=1;
cout<<x;
s=s+x;
cout<<"+";
}
x++;
}

cout<<"="<<s;

2.

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
char s[101],*p,cuv[100];
cin.get(s,101);
cin.get();
p=strtok(s," ");
while(p)
{
strcpy(cuv,p);
strlwr(cuv);
cuv[0]=cuv[0]-32;
cout<<cuv<<" ";
p=strtok(NULL," ");
}

return 0;
}

3.

#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("bac.txt");

int main()
{
int c=0,nr=0,x;
while(fin>>x)
{
if(x==c)
nr++;
else
{
cout<<c<<" "<<nr<<" ";
c=x;
nr=1;
}
}
return 0;
}

You might also like