Write a program to identify whether a given line is a comment or not.
Answers
Answered by
0
#include
#include
void main()
{
char a[100];
int i=2,j=0;
clrscr();
printf("Enter Line:\n");
gets(a);
if(a[0]=='/')
{
if(a[1]=='/')
printf("It is a comment.\n");
else if(a[1]=='*')
{
for(i=2;i<=100;i++)
{
if(a[i]=='*'&&a[i+1]=='/')
{
printf("It is a comment.\n");
j=1;
break;
}
else
continue;
}
if(j==0)
printf("It is not a comment.\n");
}
else
printf("It is not a comment\n");
}
else
printf("It is not a comment\n");
getch(
Answered by
0
Explanation:
heya mate
option A is the answer
Similar questions