C program to 5, 10, 9.

Q31. Write a C program that generates the following output:

        5

        10

        9

Assign value 5 to a variable using =. Multiply it with 2 to generate 10 and subtract 1 to generate 9.

Ans.

#include<stdio.h>

#include<conio.h>  //for clrscr()

void main()

{

int value;

value=5;

clrscr();   //for clear screen

printf(“\n %d”,value);

value=value*2;

printf(” %d”,value);

value=value-1;

printf(” %d”,value);

}

 

Output

 

5 10 9

Leave a Reply

Your email address will not be published. Required fields are marked *

144 Views
%d bloggers like this: