Hi can any one help me with this programme to translating in F# language using visual studio.
//Include the required header files.
#include
//Define the main() function.
int main()
{
//Declare the required variables.
int x,y;
//Prompt the user to enter the input.
printf(“Enter the value of x : “);
scanf(“%d”,&x);
//Check the value of x and set the value of y.
if(x>10)
{
y=x;
}
if(x<5)
{
y=x*2;
}
if(x==7)
{
y=x+10;
}
//Display the value of y.
printf(“\nThe value of y = %d”,y);
//Return 0 and exit the program.
return 0;
Please I need to turn in today can some one help me out with this.
Code:
printfn "Enter a number:" //Prompt the user to enter the
input.
let a = System.Console.ReadLine();
let x = a |> int
let mutable y = 0 //y is mutable as it can change its value
//Check the value of x and set the value of y
if(x>10) then
y<-x;
if(x<5) then
y<-x*2;
if(x=7) then
y<-x+10;
//Display the value of y.
printfn "The value of y=%d" y
Snapshot:

Thank you for asking the question, Hope you like it.
Please comment for any doubt.
Hi can any one help me with this programme to translating in F# language using visual...
please help me with this question
(in C programming language and Unix)
computer system book 3 edition
int *fun (int *x)f int value *xtt return &value; int main) int pl; int **p2; int a; char str [5] printf ("Enter a number:") scanf("%d", a) ; printf ("Enter a line:") gets (str); p1-malloc(sizeof (int)) *pl-p2; p2-malloc(sizeof (int)); pl-fun (a); n-0; for (pl-stripl<-str+5;pl++) if (isdigit (pl)) at+; return 0; Construct a table that shows for each line of code, what may be the...
Can anyone help me to make this program work in C language, this is a blackjack game #include #include #include void deal(int, int&) void deal(int, int&, int&) int getbet(int); int main() { int totdealer, totplayer; int money, bet, aces; char yesno = 'Y'; _Bool again; srand(time(0)); printf("How much money do you have? "); scanf("%d" , money); while (money>0 && toupper(yesno) == 'Y') { bet = getbet(money); totdealer...
the coding language is just the basic c language
and here is my first attempt at this problem
my problem is that if the user inputs a number that is equal
to a number that has been entered previously the code will never
end until the user enters a number that is bigger than any other
number previously entered
any help will be helpful
Write a program to read-in a sequence of integers from the keyboard using scanf(). Your program...
C program. Using do-while loop for this question. Question: write a program to calculate the average of first n numbers. output: Enter the value of n : 18 The sum of first 18 numbers =171 The average of first 18 numbers = 9.00 my code couldn't give me the right avg and sum. Please help. #include<stdio.h> int main() { int num; int count =0; int sum=0; float avg; printf("Enter the value of n: "); ...
Can someone help me . This program needs to run in visual studio and written in c++. I want to call to the function string eraseChar in the main function to use the variables str and ch. I cannot use global variables. #include<iostream> #include <string> using namespace std; string eraseChar(char ch = 'e', string str = "the bike fell in the water"); int main() { int pos; pos = str.find(ch); while (pos != string::npos) {...
C Programming - RSA Encryption I've tried to write a program that can encrypt and decrypt strings using RSA and want to be able to integrate it into a header file which contains codes for compression, linked list etc.. However, the use of global variables and fixed size of encryption is making it hard to do so Can someone please help me modify the following the code? I want to be able to just pass it in a string to...
C program help: Write a C program that uses three functions to perform the following tasks: – The first function should read the price of an item sold at a grocery store together with the quantity from the user and return all the values to main(). example: #include void getInput(int *pNum1, int *pNum2); // note: *pNum1 & *pNum2 are pointers to ints int main () { int numDucks,numCats; getInput(&numDucks, &numCats); // passing addresses of num1 & num2 to...
C Programming - RSA Encryption I've tried to write a program that can encrypt and decrypt strings using RSA and want to be able to integrate it into a header file which contains codes for compression, linked list etc.. However, the use of global variables and fixed size of encryption is making it hard to do so Can someone please help me modify the following the code? I want to be able to just pass it in a string to...
Could someone please help me with this C language code I'm confused as to why i'm getting an error every time I run it on command line if some could please help me as soon as possible. #include <stdio.h> #include <stdlib.h> int main() { char *ptr_two = (char *)malloc(sizeof(char)*50); printf("%p\n", ptr_two); ptr_two = "A constant string in C"; printf("%p\n", ptr_two); printf("%s\n", ptr_two); free(ptr_two); return 0; }
C program-- the output is not right please help me to correct it. #include <stdio.h> int main() { int arr[100]; int i,j,n,p,value,temp; printf("Enter the number of elements in the array: \n "); scanf("%d",&n); printf("Enter %d elements in the array: \n",n); for(i=0;i<n;i++) { printf("\nelement %d: ",i); scanf("\n%d",&arr[i]); } printf("\nEnter the value to be inserted: \n "); scanf("\n%d",&value); printf("The exist array is: \n"); for(i=0;i<n;i++) { printf("%d",arr[i]); } p=i; for(i=0;i<n;i++) if(value<arr[i] ) { p = i; break; } arr[p]=value; printf("\n"); for (i =...