WAP which prints initial of any name ?
#include<stdio.h>
#include<conio.h>
int main()
{
char string[200];
int i=0;
printf("Enter a string: ");
gets(string);
printf("%c", *string);
while(string[i] != '\0')
{
if(string[i] == ' ')
{
i++;
printf("%c", *(string + i));
}
i++;
}
return 0;
}
OUTPUT:-
Enter a string:
C Programming Simply
CPS
#include<stdio.h>
#include<conio.h>
int main()
{
char string[200];
int i=0;
printf("Enter a string: ");
gets(string);
printf("%c", *string);
while(string[i] != '\0')
{
if(string[i] == ' ')
{
i++;
printf("%c", *(string + i));
}
i++;
}
return 0;
}
OUTPUT:-
Enter a string:
C Programming Simply
CPS
No comments:
Post a Comment