Lipi

Input Statement

The suna statement is used to read a value from the user and store it in a variable.

Syntax

suna(variable_name);

Basic Usage

You can use suna to read input into a variable:

purna age;
bhana("Enter your age: ");
suna(age);
bhana("Your age is: ");
bhana(age);

Input for Calculations

You can use suna to read input for calculations:

purna a;
purna b;
purna sum;

bhana("Enter first number: ");
suna(a);
bhana("Enter second number: ");
suna(b);

sum = a + b;

bhana("The sum is: ");
bhana(sum);

Important Notes

  • The variable must be declared before using it with suna.
  • The input is automatically converted to the type of the variable.
  • It's a good practice to display a prompt before asking for input.

Next Steps

Now that you understand the input statement in Lipi, you can learn more about: