Computer Science, asked by kritisodhi123, 1 year ago

Describe if statement. write an if statement to multiply even numbers by 3 and odd numbers by 4

Answers

Answered by aksachan6121
0
if statements aree used in C++ when there is condition applied

kritisodhi123: please explain
kritisodhi123: i can't understood
Answered by siddhartharao77
1
When we need to execute a block of statements only when a given condition is true then we use if statement.


Ex:

#include<stdio.h>
#include<conio.h>
int main()
{   
 int result; 
 clrscr(); 
 printf("Enter any number:");   
 scanf("%d",&result);     
 if(result%2==0) 
  {
printf("The output is : %d", result * 3); 
  }   
 else 
  {
 printf("The output is : %d",result * 4); 
  }   
 return 0;
}


Hope this helps!
Similar questions