1.

Write a C program to read the address of a person in a single line and display the address in each line based on the symbol ",".input: department of computing systems,faculty of applied science.output: department of computing systems,faculty of applied science.​

Answer»

Program:

#include

#include

#include

INT main()

{

CHAR address[100];

printf("Enter the address : ");

fgets(address, sizeof(address), stdin);

for(int i = 0 ; i < STRLEN(address) ; i++)

{

  if(address[i] != ',')

  {

    printf("%C" , address[i]);

  }

  else

  {

    printf("\n");

  }

}

return 0;

}

Output:

Enter the address : department of computing systems,faculty of applied science.

department of computing systems

faculty of applied science.



Discussion

No Comment Found