Computer Science, asked by Anonymous, 2 months ago

ACTIVITY 1
MAKE THE FOLLOWING PROGRAMS:
Ronal
1. To input a number and find whether it is positive or negative.
2. To print the sum of first 10 even numbers.
3. To print the multiplication table of 15.
4. To print the odd numbers between 500 to 1000.
5. To input two numbers and depending upon the user's choice, add, subtract, multiply or divites
numbers.
6. To print the area or perimeter of a rectangle depending upon the user's choice.
7. To print the series 2, 5, 10, 17,... 101. The loop should run for 10 times.
82 Learning
Computers with​

Attachments:

Answers

Answered by IAmAmal
2

Answer:

Here you go

Explanation:

1. Input a number from user in some variable say num .

Check if(num < 0) , then number is negative.

Check if(num > 0) , then number is positive.

Check if(num == 0) , then number is zero.

2. int main()

{

int i=1,n,s=0;

printf("Enter number to set range : ");

scanf("%d",&n);

printf("\nEven numbers in range 1 to %d :\n\n",n);

for(i=1;i<=n;i++)

{

if(i%2==0)

{

printf("%d ",i);

s=s+i;

}

}

printf("\n\nSum of even numbers in range 1 to %d : %d",n,s);

return 0;

}

3. #include <stdio.h>

int main() {

int n, i;

printf("Enter an integer: ");

scanf("%d", &n);

for (i = 1; i <= 10; ++i) {

printf("%d * %d = %d \n", n, i, n * i);

}

return 0;

}

Similar questions