wap To Print Value One less than & One More Than The Given Value & Print Their Sum .
Code –
#include<stdio.h>
#include<conio.h>
void main ()
{
int a,b,c,sum;
clrscr();
printf("Enter The Value \t");
scanf("%d",&a);
b= a-1;
c= a+1;
sum=a+b+c;
printf("\nThe Value One less Than The Given Value %d",b);
printf("\nThe Value One Greater Than The Given Value %d",c);
printf("\nThe Value Of Their Sum Is %d",sum);
getch();
}
OUTPUT
Enter The Value 5
The Value One Less Than The Given Value 4
The Value One Greater Than The Given Value 6
The Value Of Their Sum Is 15
No comments:
Post a Comment