0% found this document useful (0 votes)
31 views3 pages

Vs

The document contains code snippets for reversing digits of a number, counting odd digits between two numbers, and accessing an element from an array. The code snippets demonstrate various programming concepts like loops, arrays, and input/output.

Uploaded by

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

Vs

The document contains code snippets for reversing digits of a number, counting odd digits between two numbers, and accessing an element from an array. The code snippets demonstrate various programming concepts like loops, arrays, and input/output.

Uploaded by

Mdc Imo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ex1

a.

#include <iostream>

using namespace std;

int main()

unsigned n;

int nr,a,m;

cin>>n;

nr=0;

for(a=9;a>=0;a--)

{m=n;

while ((m!=0)&&((m%10)!=a))

m=m/10;

if (m!=0)

nr=nr*10+m%10;}

cout<<nr;

return 0;

d.

#include <iostream>

using namespace std;

int main()

{
unsigned a,b,i,n,c,k=0;

cin>>a>>b;

i=a;

while((a<=i)&&(b>=i))

{n=i;

c=0;

while (n>0)

{if( n%2==1)

c=c+1;

n=n/10;}

if(c>0)

k=k+1;

i=i+1;

cout<<k;

return 0;

}#include <iostream>

using namespace std;

int main()

int i, v[100],n,k,m=0;

cin>>n>>k;

for(i=1;i<=k;i++)

for(j=i;j>=1;j--)

v[m+1]=j;

cout<<v[n];
return 0;

You might also like