Answer the question
In order to leave comments, you need to log in
How do I set a decimal in my code?
How do I get decimal to work in my code as soon as I set variable a to a fractional number . The program immediately calculates incorrectly and terminates. Silly questions . But I have a subject such as Fundamentals of Algorithmization and Programming, I just started to teach. On the remote figs you will understand
#include "stdafx.h"
#include <conio.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL,"Russian");
int a,b,S,P;
printf("-------------------------------------\n\
Программа для вычисленияn\n\периметра и площади прямоугольника.\n\
Выполнил: ФИО\n\-------------------------------------\n\ИСХОДНЫЕ ДАННЫЕ:\n");
printf("Длина (м) a=");
scanf("%i", &a);
printf("Ширина (м) b=");
scanf("%i", &b);
printf("ОТВЕТ:\nПериметр P=%i (м)\nПлощадь S=%i (м.кв)",(a+b)*2,a*b);
getch();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question