using turboc++
---------------------------------------------------------
//WAP to count all characters after first white space.
#include <stdio.h>
#include<conio.h>
void main()
{
char string[100];
printf("enter string\n");
scanf("%[^\n]s",string);//reads till new line is encountered or untill new line is encountered
for(int i=0;string[i]!='\0';i++)//loop execution till the null character is reached.
{
if(string[i]==' ')//condition testing
{
break; //exits the loop
}
else
{
printf("%c",string[i]);//prints the character
}
}
getch();
}
------------------------------------------------------------------------------
using codeblocks
--------------------------------------------------
//WAP to count all characters after first white space.
#include <stdio.h>
int main()
{
char string[100];
printf("enter string\n");
scanf("%[^\n]s",string);//reads till new line is encountered or untill new line is encountered
for(int i=0;string[i]!='\0';i++)//loop execution till the null character is reached.
{
if(string[i]==' ')//condition testing
{
break; //exits the loop
}
else
{
printf("%c",string[i]);//prints the character
}
}
return 0;
}
---------------------------------------------------------
//WAP to count all characters after first white space.
#include <stdio.h>
#include<conio.h>
void main()
{
char string[100];
printf("enter string\n");
scanf("%[^\n]s",string);//reads till new line is encountered or untill new line is encountered
for(int i=0;string[i]!='\0';i++)//loop execution till the null character is reached.
{
if(string[i]==' ')//condition testing
{
break; //exits the loop
}
else
{
printf("%c",string[i]);//prints the character
}
}
getch();
}
------------------------------------------------------------------------------
using codeblocks
--------------------------------------------------
//WAP to count all characters after first white space.
#include <stdio.h>
int main()
{
char string[100];
printf("enter string\n");
scanf("%[^\n]s",string);//reads till new line is encountered or untill new line is encountered
for(int i=0;string[i]!='\0';i++)//loop execution till the null character is reached.
{
if(string[i]==' ')//condition testing
{
break; //exits the loop
}
else
{
printf("%c",string[i]);//prints the character
}
}
return 0;
}