# a simple if statement to output the award of athletes in a competition

asked Nov 22, 2019

 rank award 1 1000,00 2 500,000 3 250,000
 any other 0

+1 vote
answered Nov 26, 2019 by anonymous
#include<stdio.h>

void main()

{int a;

printf("enter the rank");

scanf("%d",&a);

if(a==1)

printf("10,00,000");

else if(a==2)

printf("5,00,000");

else if(a==3)

printf("2,50,000");

else

printf("0");

}
–1 vote
answered Nov 27, 2019 by (1,150 points)
–1 vote
answered Nov 27, 2019 by (780 points)
answered Nov 27, 2019 by anonymous
#include <stdio.h>
#include <string.h>
int main()
{
const char* a[] = {"1000,00", "500,000", "250,000"};
int r;
printf("enter the rank");
scanf("%d", &r);
char s[10] ;
strcpy (s, (r < 4 && r>0)? a[r-1] : "0");

printf("will get %s", s);
return 0;
}
answered Nov 28, 2019 by anonymous
rank= float(input("Enter a number: "))
if rank==1:

award=100000
print(award)

elif rank==2:

award=500000
print(award)

elif rank==3:

award=250000

print(award)

else:

print(0)
answered Nov 29, 2019 by Noam0509
in Java:

import java.util.Scanner; //import Scanner
public class Main{ //create class
public static void main(String[] args) { //create public main method

int award; //the award int
Scanner sc = new Scanner(System.in); //creating the scanner
System.out.println("Pls enter you rank: "); //telling him to enter the rank
int rank = sc.nextInt(); //Creating the rank int and the user input

if(rank == 1){ //the first if
award = 1000000; // setting the award to 1,000,000
}

else if(rank == 2){ //second if

award = 500000;  //setting -award to be 500,000
}

else if(rank == 3){ //3 if
award = 250000; //setting award to be 250,000
}

else{ //the last else here goes everyone whos not from the first 3
award = 0; // setting thier award to be 0
}

System.out.println("this is your award: " + award);//printing the result
}
}