Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
C-Programming/C Project/Basic_Calculator/main.c
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (30 sloc)
677 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
#include <stdlib.h> | |
/*int main() | |
{ | |
double num1; | |
double num2; | |
printf("Enter first number: "); | |
scanf("%lf", &num1); | |
printf("Enter second number: "); | |
scanf("%lf", &num2); | |
printf("Answer is %f", num1 + num2); | |
return 0; | |
}*/ | |
int main() | |
{ | |
char color[20]; | |
char pluralNoun[20]; | |
char celebrityF[20]; | |
char celebrityL[20]; | |
printf("Enter a color: "); | |
scanf("%s", &color); | |
printf("Enter a plural noun: "); | |
scanf("%s", &pluralNoun); | |
printf("Enter a celebrity: "); | |
scanf("%s%s", celebrityF, celebrityL); | |
printf("Roses are %s,\n", color); | |
printf("%s are blue,\n", pluralNoun); | |
printf("I love %s %s.", celebrityF, celebrityL); | |
} |