Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

NIL GADHIYA Practical 2 23SE02IE068

Aim 1 : Write a program take 3 different datatypes variables and print.

Input :

#include <stdio.h>

int main()

int var1 = 10;

float var2 = 3.14;

char var3 = 'A';

printf("Variable 1 (Integer): %d\n", var1);

printf("Variable 2 (Float): %.2f\n", var2);

printf("Variable 3 (Character): %c\n", var3);

return 0;

Output :

Aim 2 : Write a program take 2 values and print Arithmetic's value using
Arithmetic Operator.

Input :
NIL GADHIYA Practical 2 23SE02IE068

#include <stdio.h>

int main()

float value1, value2;

printf("Enter the first value: ");

scanf("%f", &value1);

printf("Enter the second value: ");

scanf("%f", &value2);

float addition = value1 + value2;

float subtraction = value1 - value2;

float multiplication = value1 * value2;

float division = value1 / value2;

printf("Addition: %.2f\n", addition);

printf("Subtraction: %.2f\n", subtraction);

printf("Multiplication: %.2f\n", multiplication);

printf("Division: %.2f\n", division);

return 0;}

Output :

You might also like