In: Computer Science
Playing with strings Assignment
Outcomes:
Program Specifications:
DESIGN and IMPLEMENT a short program that will:
Hint: Use a technique to read in strings that allows spaces:
https://www.programmingsimplified.com/c/program/print-string
Submission Requirements:
Requirements will be same as the first assignment which will be the same for all future assignments.
DO NOT:
#include <stdio.h>
int main()
{
char z[100];
int n=1;
do{
printf("Enter a string\n");
gets(z);
printf("\nThe string in forward:
");
int size=0;
while(z[size]!='\0')
{
printf("%c",z[size]);
size++;
}
printf("\nThe string in backward:
");
for(int i=size-1;i>=0;i--)
printf("%c",z[i]);
printf("\nThe string verticaly
is\n");
for(int i=0;i<size;i++)
printf("%c\n",z[i]);
int k=0;
printf("\nThe string in the form of
triangle is:\n");
for(int
i=0;i<5&&k<size;i++)
{
for(int
j=5;j>i;j--)
printf(" ");
for(int
j=0;j<=i&&k<size;j++)
{
printf("%c ",z[k]);
k++;
}
printf("\n");
}
int no=0;
for(int i=0;i<size;i++)
{
if((z[i]>='a'&&z[i]<='z')||(z[i]>='A'&&z[i]<='Z'))
no++;
}
printf("\nThe numbers of letter in
the string is : %d\n",no);
printf("Enter 1 to enter one more
string else 0");
scanf("%d",&n);
}while(n==1);
return 0;
}