Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, 2 June 2016

PROBLEM 2:
Write a C Program for the following set of conditions:
R = 50 for S <= 1000 R = 100 for S = 1001–4000

R = 250 for S = 4001–8000  otherwise R = 75



CODE:
#include<stdio.h>
main()
{
// Variable declaration//
int S;
//Initialization
S=0;
 /*Input*/
    printf("Enter S Value:");
    scanf("%d",&S);
    /* actual Working */
if(S>=1 &&S<=1000)
{
printf("R=50");
}
else if(S>=1001 && S<=4000)
{
printf("R=100");
}
else if(S>=4001 && S<=8000)
{
printf("R=250");

}
else if(S>8000)
{
printf("R=75");

}
return 0;
}

Program Output:



No comments:

Post a Comment