Write a program to print The number of lines depends on the

Write a program to print The number of lines depends on the number you typed in when running the program Write a program to let you type in a group of number(you also need to type in how many numbers you will type In), and calculate the range of these numbers.

Solution

3.

#include <stdio.h>

void printstar(int n)
{
int i, j;

for(i = 1; i <= n; i++)
{
for(j = 1; j <= i; j++)
{
printf(\"*\");
}
printf(\"\ \");
}
}

int main()
{
printstar(10);
return 0;
}

4.

#include <stdio.h>

int main()
{
int max = 0;
int min = 0;

int n;
printf(\"Enter number of numbers to be entered: \");
scanf(\"%d\", &n);

if (n >= 1)
{
int num;
printf(\"Enter number 1: \");
scanf(\"%d\", &num);
max = num;
min = num;
}

int i;
for(i = 1; i < n; i++)
{
int num;
printf(\"Enter number %d: \", i+1);
scanf(\"%d\", &num);
if (num < min)
min = num;
if (num > max)
max = num;
}

printf(\"Range of number is %d - %d\ \", min, max );

return 0;
}

 Write a program to print The number of lines depends on the number you typed in when running the program Write a program to let you type in a group of number(y
 Write a program to print The number of lines depends on the number you typed in when running the program Write a program to let you type in a group of number(y

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site