Assignment Worksheet 1 Try - IF .. ELSE Programs
Please watch the video for the full session - 8:
a)
Input
A
Output
Yes
b)
Input
S
Output
No
2. Write a C program to find the maximum between two numbers
using if else. C program to input two numbers from the user and find the
maximum between two numbers using if else. How to find maximum or minimum
between two numbers using if else in C programming.
Input
Input num1: 10
Input num2: 20
Output
Maximum = 20
3. Print the ASCII code/value for the given character
Input
A
Output
65
4. Write a C program to check whether a number is even or
odd using if else. How to check whether a number is even or odd using if else
in C program. C Program to input a number from the user and check whether the
given number is even or odd. Logic to check even and odd numbers using
if...else in C programming.
Input
Input number: 10
Output
10 is even number
Input
Input number: 9
Output
is odd number
5. Write a C program to check positive, negative or zero
using simple if or if else. C program to input any number from the user and
check whether the given number is positive, negative or zero. Logic to check
negative, positive or zero in C programming.
Input
Input number: 23
Output
23 is positive
Input
Input number: -3
Output
-3 is Negative
6. Write a C program to enter month number between (1-12)
and print number of days in month using if else. How to print the number of
days in a given month using if else in C programming. Logic to find the number
of days in a month in the C program.
Input
Enter month number: 1
Output
It contains 31 days.
Input
Enter month number: 4
Output
It contains 30 days.
7. Write a C program to input two numbers from user and
calculate their sum. C program to add two numbers and display their sum as
output. How to add two numbers in C programming.
Input
Input first number: 20
Input second number: 10
Output Sum = 30
8. Write a C program to input two numbers and perform all
arithmetic operations. How to perform all arithmetic operation between two
numbers in C programming. C program to find sum, difference, product, quotient
and modulus of two given numbers.
Input
First number: 10
Second number: 5
Output
Sum = 15
Difference = 5
Product = 50
Quotient = 2
Modulus = 0
No comments:
Post a Comment