Trend micro security for your Mac or pc or trend micro mobil security for your android or iOS Mobil device?
Hope this helps!
#include<stdio.h>
#include<stdlib.h>
int comment1(FILE *fp)
{
char ch;
int count=0;
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='\n')
{
return count;
}
count++;
}
return count;
}
int comment2(FILE *fp)
{
char ch;
int count=0;
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='*')
{
fscanf(fp,"%c",&ch);
if(ch=='/')
{
return count;
}
count++;
}
count++;
}
return 0;
}
int main()
{
printf("Enter the file name:");
char s[1000],ch,ch1;
scanf("%s",s);
FILE*fp;
fp = fopen(s,"r");
int count=0;
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='\"')
{
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='\"')
{
break;
}
if(ch=='\\')
{
fscanf(fp,"%c",&ch);
}
}
}
else if(ch=='/')
{
fscanf(fp,"%c",&ch);
if(ch=='/')
{
count += comment1(fp);
}
else if(ch=='*')
{
count += comment2(fp);
}
}
}
printf("%d\n",count);
return 0;
}
Answer:
Both compiled and interpreted languages are high-level languages and translate code for a computer to understand.
Explanation:
The one similarity between compiled and interpreted languages is that they are both high-level languages.
A high-level language is a computer language written in easy to understand human language which is then converted to machine code for the computer to understand.
A high-level language can either be interpreted or compiled.
An interpreted is a language in which the code is translated line by line before execution while a compiled language is one in which the source code is converted directly into machine language before execution.
So, <u>the similarity between both languages is that they are high level languages and translate code for a computer to understand. </u>