Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // first_c.cpp : Defines the entry point for the console application.
- //
- #
- include "stdio.h"
- int main() {
- star_6();
- return 0;
- }
- cube() {
- int marks;
- printf("please enter your mark here!\n");
- scanf_s("%d", & marks);
- if (marks > 40) {
- printf("your mark is good!");
- } else {
- printf("your mark is not good!");
- }
- }
- square() {
- float num;
- printf("please enter your number here!\n");
- scanf_s("%f", & num);
- float square = num * num;
- float cube = num * num * num;
- printf("square of the number is : %f\n", square);
- printf("cube of the number is : %f\n", cube);
- }
- celsius() {
- float fahrenheit;
- printf("please enter fahrenheit here!\n");
- scanf_s("%f", & fahrenheit);
- float C = 5 / 9.0 * (fahrenheit - 32);
- printf("celsius of the fahrenheit is : %f\n", C);
- }
- area() {
- float length;
- printf("please enter the length of the sqaure : \n");
- scanf_s("%f", & length);
- float area = length * length;
- printf("area of the square is : %f\n", area);
- }
- tax() {
- float amount;
- float tax_rate;
- printf("please enter the amount of the good here : \n");
- scanf_s("%f", & amount);
- printf("please enter the tax rate of the good here : \n");
- scanf_s("%f", & tax_rate);
- float sales_tax = amount * tax_rate / 100;
- printf("sales tax of the good is : %f\n", sales_tax);
- float total_amount = amount + sales_tax;
- printf("total amount of the good id : %f\n", total_amount);
- }
- price() {
- float price_of_item;
- float amount_of_cash;
- printf("please enter price of the item here!\n");
- scanf_s("%f", & price_of_item);
- printf("please enter the amount of the cash , the customer gave you here\n");
- scanf_s("%f", & amount_of_cash);
- float amount_of_change = amount_of_cash - price_of_item;
- printf("amount of change that given to customer is : %f\n", amount_of_change);
- }
- star_1() {
- for (int i = 0; i < 4; i++) {
- //printf("\n");
- for (int j = 0; j < 5; j++) {
- printf("*");
- }
- printf("\n");
- }
- }
- star_2() {
- for (int i = 1; i < 5; i++) {
- for (int j = 0; j < i; j++) {
- printf("*");
- }
- printf("\n");
- }
- }
- star_3() {
- for (int i = 1; i < 5; i++) {
- for (int j = 0; j < i; j++) {
- printf("%d", i);
- }
- printf("\n");
- }
- }
- star_4() {
- for (int i = 1; i < 5; i++) {
- int a = 65;
- for (int j = 0; j < i; j++) {
- printf("%c", a + j);
- }
- printf("\n");
- }
- }
- star_5() {
- for (int i = 5; i > 0; i--) {
- for (int j = 0; j < i; j++) {
- printf("*");
- }
- printf("\n");
- }
- }
- star_6() {
- for (int i = 1; i < 5; i++) {
- int a = 1;
- for (int j = 0; j < i; j++) {
- printf("%d", a + j);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement