Question

In: Computer Science

1a) Write a program in C programming language to determine *pass* or *fail*. Use the GP...

1a) Write a program in C programming language to determine *pass* or *fail*. Use the GP (
0.00 - 1.49 -> fail
1.50 - 4.00 -> pass
)
1b) Write a program in C to display month in Islamic Calendar.

Solutions

Expert Solution

1a) assuming that the user is providing the GP value to the program

#include<stdlib.h>

#include<studio.h>

void main()

{

float GP;. //declaring a variable of type float

printf("Enter your Grade Point");

scanf("%f",&GP); //inputting the GP value from user

if(GP>=0.00 && GP<=1.49) //checking conditions

{

printf("FAIL");

}

else if (GP>=1.50 && GP<=4.00)

{

printf("PASS");

}

else

{

printf("invalid Input");

}

}

1b) assuming user is providing the month number to find the corresponding month name.

#include<stdlib.h>

#include<stdiomh>

void main()

{

int month_num; //decalring variable

printf("Enter the month number to find the corresponding month name");

scanf("%d",&month_num);

switch (month_num) //switch case begin

{

case 1:

printf("Muharram");

case 2:

printf("Safar");

case 3:

printf("Rabī al Awwal");

case 4:

printf("Rabī al Thani");

case 5:

printf("Jamada al Ula");

case 6:

printf("Jamada al Akhira");

case 7:

printf("Rajab");

case 8:

printf("Shaban");

case 9:

printf("Ramadan");

case 10:

printf("Shawwal");

case 11:

printf("Dhu al Qadah");

case 12:

printf("Dhu al Hijjah");

default: //to handle exceptions

printf("invalid Input");

} //Switch case end

}


Related Solutions

Write a program to create a tree randomly. You can use C++ programming language. The input...
Write a program to create a tree randomly. You can use C++ programming language. The input is the number of vertices in the tree, and the output is an adjacent list of the tree. (Managed to complete this assignment with a binary tree. But, was told I needed a general tree instead)
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user...
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user to enter the three examinations ( test 1, test 2, and test 3), homework, and final project grades then calculate and display the overall grade along with a message, using the selection structure (if/else). The message is based on the following criteria: “Excellent” if the overall grade is 90 or more. “Good” if the overall grade is between 80 and 90 ( not including...
In C programming language, write the program "3x3" in size, calculating the matrix "c = a...
In C programming language, write the program "3x3" in size, calculating the matrix "c = a * b" by reading the a and b matrices from the outside and writing on the screen?
In programming C language, write a program that creates a binary tree of words to be...
In programming C language, write a program that creates a binary tree of words to be used as a spell checking device for various text files. The list of words will come from a file “words.txt”. Your program is to read through the “words.txt” file and insert the word on that line into the tree in lexicographic order (also known as Dictionary order). Words in the file will be separated by spaces. Once this is done, your program should then...
In programming C language, write a program that creates a binary tree of words to be...
In programming C language, write a program that creates a binary tree of words to be used as a spell checking device for various text files. The list of words will come from a file “words.txt”. Your program is to read through the “words.txt” file and insert the word on that line into the tree in lexicographic order (also known as Dictionary order). Words in the file will be separated by spaces. Once this is done, your program should then...
Programming Language Required: C Write a multithreaded program in C (not c++) using the pthread library...
Programming Language Required: C Write a multithreaded program in C (not c++) using the pthread library and dynamic memory(malloc) that multiplies two matrices together. The numbers in the matrices must be read in from a text file. The program should also check if the two matrices are capable of being multiplied together. The amount of threads used has to be dynamic. The user should be able to choose how many threads they wish to use using the command line. Finally,...
C++ programming language. Write a program that will read in id numbers and place them in...
C++ programming language. Write a program that will read in id numbers and place them in an array.The array is dynamically allocated large enough to hold the number of id numbers given by the user. The program will then input an id and call a function to search for that id in the array. It will print whether the id is in the array or not. Sample Run: Please input the number of id numbers to be read 4 Please...
In C Programming Language Write a program to output to a text log file a new...
In C Programming Language Write a program to output to a text log file a new line starting with day time date followed by the message "SUCCESSFUL". Please screenshot the results.
Programming Language: C++ Overview For this assignment, write a program that will simulate a single game...
Programming Language: C++ Overview For this assignment, write a program that will simulate a single game of Craps. Craps is a game of chance where a player (the shooter) will roll 2 six-sided dice. The sum of the dice will determine whether the player (and anyone that has placed a bet) wins immediately, loses immediately, or if the game continues. If the sum of the first roll of the dice is equal to 7 or 11, the player wins immediately....
Lab 1 Write a program in the C/C++ programming language to input and add two fractions...
Lab 1 Write a program in the C/C++ programming language to input and add two fractions each represented as a numerator and denominator. Do not use classes or structures. Print your result (which is also represented as a numerator/denominator) to standard out. If you get done early, try to simplify your result with the least common denominator. The following equation can be used to add fractions: a/b + c/d = (a*d + b*c)/(b*d) Example: 1/2 + 1/4 = ( 1(4)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT