What code will i use in c++, if i input 6 numbers and then i will get the 3rd, 5th, and 6th number?

Example:

Enter number :123456
3rd, 5th and 6th number : 356

If you are entering these on the command-line, you will access the values through argv.

Argv is zero-based, but the first argument (0) is the program name, so start with argv[1].

argv[1] will contain a string containing "123456", so you will need to access each element as a character (or like a two-dimensional zero-based array) argv[1][2] and so on.

#include<stdio.h>
#include<conoio.h>
void main()
{
int i;
clrscr();
if (i%2==0)
{
printf("the number is",i);
else if(i==num)
printf("the number is",i);
} getch();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.