0% found this document useful (0 votes)
84 views

Programming

Bibi is a student who wants to create an easy programming problem for her friends. She asks N other students if they think the problem is hard or easy. If any student thinks it is hard, the problem is not easy. Otherwise it is easy. The program takes in N and the opinions of the N students, and outputs whether the problem is easy or not easy based on the opinions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Programming

Bibi is a student who wants to create an easy programming problem for her friends. She asks N other students if they think the problem is hard or easy. If any student thinks it is hard, the problem is not easy. Otherwise it is easy. The program takes in N and the opinions of the N students, and outputs whether the problem is easy or not easy based on the opinions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

View this question in the app

× ★★★★★ GE T APP
4,000+ five-star reviews

  Textbook Solutions Expert Q&A 

home / study / engineering / computer science / computer science questions and answers / c...

Question: C programming language Bibi is a genius student


from Binus computer science major, she wants to h...

C programming language

Bibi is a genius student from Binus computer science major, she wants to help her friends to understand
programming better and decides to write a problem for them, but she can't decide if her problem is easy
enough for her friends to solve. As she is also a very busy student, she needs your help in determining if
her problem is easy or not. Ironically, she has the time to ask N other genius friends on their opinion about
the problem she wrote. If no one considers the problem to be hard then the problem is easy, otherwise it is
not easy.

Format Input: The rst line in the input is an integer N, the number of genius friends Bibi asked. The
second line consists of N integers ai, their opinion on the problem. If ai is 1 then they think the problem is
hard, if ai is 0 then they think the problem is easy.

Format Output: Print "easy" (without quotes) if Bibi's problem is easy, print "not easy" (without quotes) if
Bibi's problem is not easy.

Constraints: 1<=N<=100 0<=ai<=1.

Sample Input | Sample Output

0 1 1 0 1 | not easy

Expert Answer

sweet123
answered this

Coding:

#include <stdio.h>//Header le for input and output

int main()

{
int N,i=0, ag=0;//Here declare relavent variable N is number of Friends, ag is for setting up wheater it is 0
or 1

int ai[100];//array for for store opionion

printf("Please Enter Number how much genius friends Are:");//output display

scanf("%d",&N);//store value in N

printf("Press 1 For Hard \nPress 0 For Easy \n");//output display

for(i=0;i<N;i++)//For loop for gate opionion

printf("Opionion of %d:",i+1);//output

scanf("%d",&ai[i]);//store opioion in array

for(i=0;i<N;i++)//check wheater any hard or not in for loop

if(ai[i]==1)//checking hard or not

ag=1;//if it is then change ag value to 1

break;//and break the loop

if( ag==0)

printf("\n Problem is Easy");//output display

else

printf("\n Problem is Hard");//output display

return 0;

Code snap:
if you still have any dout regarding this question please comment and if you like my code please
appreciate me by thumbs up thank you.........

0 Comments

Was this answer helpful? 1

0
Questions viewed by other students

A percentage differential relay with the characteristics shown by g 2 has been used on each phase of a
generator stator windings as shown by g1. The minimum pick up value is 0.15A and the slope "K" of
the operating characteristic line shown by g2 is K=0.1. A high resistance fault has occurred near the
grounded end of the stator winding as shown. The total value of fault and...
See answer

C programming language After preparing an easy problem, Bibi wants to pop balloons. Bibi can only
pop a balloon if her strength is strictly greater than the toughness of the balloon. Given her strength
and the toughness of the balloons, she wants you to predict how many balloons she can pop. Format
Input: The rst line of the input consists of two integers N and P, the number of...
See answer 100% (1 rating)

ABOUT CHEGG

LEGAL & POLICIES


CHEGG PRODUCTS AND SERVICES

CHEGG NETWORK

CUSTOMER SERVICE

© 2003-2019 Chegg Inc. All rights reserved.

You might also like