1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
arsen [322]
3 years ago
7

(main.c File)

Computers and Technology
1 answer:
nlexa [21]3 years ago
7 0

Answer:

C code

Explanation:

#include <stdio.h>

void histrogram(int counters[])

{

   int i,j;

   int count;

   for(i=0;i<26;i++)

   {

       count=counters[i];

       printf("%c ",i+97);

       for(j=0;j<count;j++)

       {

           printf("="); //= is used

       }

       printf("\n");

      

   }

      

}

int main()

{

   FILE* fp;

   int i;

   int arr[26];

   char c;

   int val;

   // Open the file

fp = fopen("story.txt", "r");

  

if (fp == NULL) {

printf("Could not open file ");

return 0;

}

else

{

   for(i=0;i<26;i++)

   arr[i]=0;

  

   for (c = getc(fp); c != EOF; c = getc(fp))

   {

       if(c>='a' && c<='z')

       {

           val = c-97;

           //printf("%d ",val);

           arr[val]++;

          

           }

       }

       histrogram(arr);

      

  

      

  

   }

}

You might be interested in
(03.04 MC) While working in a group, two members are not getting along. You ask each one what is happening, and they both say th
solniwko [45]

Answer:

Agree upon the problem Brainstorm possible

Explanation:

7 0
3 years ago
Read 2 more answers
Steven is in a meeting and he is sharing a graph on his monitor with fifty other people. So that the others do not need to crowd
nevsk [136]
The answer is D) Projector because with a projector, its in the name project so it can anything u put on their, and put it on a virtual screen that can be put on a wall, so everyone can see.
8 0
3 years ago
g Write a program that prompts the user for an integer n between 1 and 100. If the number is outside the range, it prints an err
grin007 [14]

Answer:

The cpp program is given below.

#include<iostream>

#include<iomanip>

using namespace std;

int main() {

   

   // variables declared

   int n;

   int sum=0;

   float avg;

   

   do

   {

       // user input taken for number    

       cout<< "Enter a number between 1 and 100 (inclusive): ";

       cin>>n;

       

       if(n<1 || n>100)

           cout<<" Number is out of range. Enter valid number."<<endl;

       

   }while(n<1 || n>100);

   

   cout<<" "<<endl;

   

   // printing even numbers between num and 50  

   for(int num=1; num<=n; num++)

   {

       sum = sum + num;

   }

   

   avg = sum/n;

   

   // displaying sum and average

   cout<<"Sum of numbers between 1 and "<<n<<" is "<<sum<<endl;

   cout<<"Average of numbers between 1 and "<<n<<" is ";

   printf("%.2f", avg);

   

       return 0;

}

OUTPUT

Enter a number between 1 and 100 (inclusive): 123

Number is out of range. Enter valid number.

Enter a number between 1 and 100 (inclusive): 56

 

Sum of numbers between 1 and 56 is 1596

Average of numbers between 1 and 56 is 28.00

Explanation:

The program is explained below.

1. Two integer variables are declared to hold the number, n, and to hold the sum of numbers from 1 to n, sum. The variable sum is initialized to 0.

2. One float variable, avg, is declared to hold average of numbers from 1 to n.

3. User input is taken for n inside do-while loop. The loop executes till user enters value between 1 and 100. Otherwise, error message is printed.

4. The for loop executes over variable num, which runs from 1 to user-entered value of n.

5. Inside for loop, all the values of num are added to sum.

sum = sum + num;

6. Outside for loop, average is computed and stored in avg.

avg = sum/n;

7. The average is printed with two numbers after decimal using the following code.

printf("%.2f", avg);

8. The program ends with return statement.

9. All the code is written inside main() and no classes are involved.

3 0
3 years ago
Identify the characteristics of syntax errors. Choose all that apply.
kodGreya [7K]

Answer:

Explanation:

Identify the characteristics of syntax errors. Choose all that apply.

programmer did not follow the program language conventions

may be highlighted while writing the program

can be caused by mistyping or misspelling while writing the program

8 0
3 years ago
Read 2 more answers
is this website just for a bunch of lazy kids bumming off answers? Because if that were the case I'd be one of them.
Orlov [11]
No, in fact. Brainly is to help people who are having homework trouble, but not to just give out answers. The best answers on Brainly are the ones that explain in a simple way how they got their answer, and (obviously) that it's correct. If you need help on homework, then try and make sure your question is clear and appropriate. You'll most likely get better luck if you place it in the correct subject, and better answers if they can understand it. Also make sure when you answer questions that it's clear, simple, appropriate, and (again, obviously) correct.

<span>I hope this helped! Please take the time to rate, pick the Brainliest answer (not necessarily mine!), and thank me if you feel I helped with this question! Thank you, it helps me a lot. :)</span>

5 0
3 years ago
Other questions:
  • A company ABC asked you to design a simple payroll program that calculates and employee's weekly gross pay, including any overti
    9·1 answer
  • 3. You are a network administrator responsible for all network platforms and services. The Teta Company currently has only one b
    13·2 answers
  • Define function multiply(), and within the function: Get user input() of two strings made of whole numbers Cast the input to int
    11·1 answer
  • You've been hired as a consultant to help an online store owner. You need to complete the implementation of conversion tracking
    6·1 answer
  • in python Write a loop that counts the number of lowercase characters that appear in the string referenced by mystring.
    11·1 answer
  • Say you find a module in a package that does a lot of awesomely useful things, but the name of it is module_that_does_many_aweso
    12·1 answer
  • Searching for a particular record in a database is called “querying the data.”<br> True<br> False
    9·2 answers
  • JAVA
    12·1 answer
  • Join for a pack battle loud microphone.
    10·1 answer
  • Why are men more exposed to mass media?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!