Computer Science, asked by marvinganupalli7916, 1 year ago

C program to identify whether a given line is a comment or not.


irfanbari123: #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();

Answers

Answered by Anonymous
6
Challenge

Write a program that reorders the ASCII characters!

It should output a single string containing all of the printable ASCII characters exactly once. The first character of this string is assigned the value 1, the second character the value 2, and so on.

If two characters are normally next to each other (the difference between their character codes is 1), they may not appear next to each other in the output.

Scoring

Your score will be the sum of the values for all of the characters in your source code, as dictated by your program's output.

Please see the Verification section to calculate your score.

Lowest score wins!

Rules

"Printable ASCII" is defined to mean character codes 32 - 126, inclusive.
You may write a full program or a function.
Your code may only contain printable ASCII characters and newlines.
Your program may not take any input.
Newlines will always have the value 1. Your program's output should not include a newline.
Verification

Use this stack snippet to verify that your code's output is valid, and to calculate your code's score!
Answered by Ashi03
0
Challenge

Write a program that reorders the ASCII characters!

It should output a single string containing all of the printable ASCII characters exactly once. The first character of this string is assigned the value 1, the second character the value 2, and so on.

If two characters are normally next to each other (the difference between their character codes is 1), they may not appear next to each other in the output.

Scoring

Your score will be the sum of the values for all of the characters in your source code, as dictated by your program's output.

Please see the Verification section to calculate your score.

Lowest score wins!

Rules

"Printable ASCII" is defined to mean character codes 32 - 126, inclusive.
You may write a full program or a function.
Your code may only contain printable ASCII characters and newlines.
Your program may not take any input.
Newlines will always have the value 1. Your program's output should not include a newline.
Verification

Use this stack snippet to verify that your code's output is valid, and to calculate your code's score!

hope helps you
Similar questions