Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For each of the following problems, design the flowchart and the pseudo-code. a)

ID: 3928082 • Letter: F

Question


For each of the following problems, design the flowchart and the pseudo-code. a) A computer controlling a gate works an follows: ll prompts the user to enter a code using a keyboard. If the code matches the secret code (123), it displays the message "Welcome, please get in", if not it displays "Invalid code, ". b) A machine sorting eggs reads the egg's weight then sorts the egg and displays its category according to the following scheme: c) Write a program the computes the following sum: S = 1 + 2 + 3 +......n. Where n is a number entered by the user. The program must ensure that value entered for n is positive.

Explanation / Answer

C. A program to find the sum of Natural Numbers :-

#include<stdio.h>
int main()
{
int n, i;
int S = 0;
  
printf("Enter a positive Integer to compute the sum ") ;
scanf("%d", &n) ;
  
for(i = 1; i <= n; i++)
{
S = S + i;
}
  
printf("The Sum of Natural Numbers is = %d", S) ;
return 0 ;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote