PLEASE WRITE FLOWCHART FOR THESE CODES, THEY ARE IN ONE QUESTION I JUST NEED THE FLOWCHART FOR THEM, PLEASE HELP. 1 #include int main(void) { //dec;aring variables int A,B,C,D; int maximum,max1,max2; int minimum,min1,min2; printf("please enter first number\n A:"); scanf("%d",&A); printf("please enter second number\n B"); scanf("%d",&B); printf("please enter third number\n C"); scanf("%d",&C); printf("please enter fourth number\n D"); scanf("%d",&D); //DIVIDE THE 4 NUMBERS TO TOW GROUPS if(A>B) { max1 = A; } else max1 = B; if(C>D) { max2 = C; } else max2 = D; //check the maximum od each GROUP if(max1>max2) { maximum=max1; } else maximum=max2; printf("maximum=%d\n",maximum); if(A #define s 3 #define a 2 int main() { int k[s][a]; int i,j; float aver; printf("p;ease enter array values:"); for(i=0;i int main() { int num,count=1, sum=0; printf("enter a positive integer:"); scanf("%d",&num); //for loop terminates when sum is less than count while(count<=num) { sum=sum+count; count++; } printf("sum=%d",sum); return 0; }
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
PLEASE WRITE FLOWCHART FOR THESE CODES, THEY ARE IN ONE QUESTION I JUST NEED THE FLOWCHART FOR THEM, PLEASE HELP.
1
#include<stdio.h>
int main(void)
{
//dec;aring variables
int A,B,C,D;
int maximum,max1,max2;
int minimum,min1,min2;
printf("please enter first number\n A:");
scanf("%d",&A);
printf("please enter second number\n B");
scanf("%d",&B);
printf("please enter third number\n C");
scanf("%d",&C);
printf("please enter fourth number\n D");
scanf("%d",&D);
//DIVIDE THE 4 NUMBERS TO TOW GROUPS
if(A>B)
{
max1 = A;
}
else
max1 = B;
if(C>D)
{
max2 = C;
}
else
max2 = D;
//check the maximum od each GROUP
if(max1>max2)
{
maximum=max1;
}
else
maximum=max2;
printf("maximum=%d\n",maximum);
if(A<B)
{
min2=A;
}
else
min2=B;
if(C<D)
{
min2=C;
}
else
min2=D;
if(min1<min2)
{
minimum=min1;
}
else
printf("minimum =%d",minimum);
//print the minimum NUMBER
return 0;
}
2
#include<stdio.h>
#define s 3
#define a 2
int main()
{
int k[s][a];
int i,j;
float aver;
printf("p;ease enter array values:");
for(i=0;i<s;i++){
for(j=0;j<a;j++){
printf("\narray value:",i,j);
scanf("%d",&k[i][j]);
}
}
aver= 0;
for(i=0;i<s;i++){
for(j=0;j<a;j++){
aver+=k[i][j];
}
}
aver=aver/(s*a);
printf("\nAverage=%.3f,aver");
return 0;
}
3
#include<stdio.h>
int main()
{
int num,count=1, sum=0;
printf("enter a positive integer:");
scanf("%d",&num);
//for loop terminates when sum is less than count
while(count<=num)
{
sum=sum+count;
count++;
}
printf("sum=%d",sum);
return 0;
}
Step by step
Solved in 2 steps with 1 images