100% toatl cost incurred while buying multiple items: nptel based class

// Online C compiler to run C program online
#include <stdio.h>
void main()
{
    int i,no_of_fruits[4],pricepu[4],total=0;
    /*let the fruits be araTi, kamalA (Nagpur), apple (himAchal pradEsh), sapOTA*/
    for(i=0;i<4;i++)
    {
        printf("\n enter the no of fruits of type %d purchased:",i+1);
        scanf("%d",&no_of_fruits[i]);
        printf("\n enter price per unit of this fruit:");
        scanf("%d",&pricepu[i]);
        total=total+no_of_fruits[i]*pricepu[i];
    }
    printf("\n total cost of fruits=%d",total);
} /* పండ్లు ఆరోగ్యానికి మేలు*/

ఔట్పుట్ తెరమీద
enter the no of fruits of type 1 purchased:10
enter price per unit of this fruit:4
enter the no of fruits of type 2 purchased:6
enter price per unit of this fruit:8
enter the no of fruits of type 3 purchased:5
enter price per unit of this fruit:20
enter the no of fruits of type 4 purchased:12
enter price per unit of this fruit:3
total cost of fruits=224
/*reference NPTEL lecture video on 'Linear Search': Problem Solving through Programming in C, IIT Kharagpur. Prof. Anupam Basu*/    

కామెంట్‌లు

ఈ బ్లాగ్ నుండి ప్రసిద్ధ పోస్ట్‌లు

100% C prog to write content into a file and then read it back onto the console

Spic macay

శ్రీరస్తు.. రామలింగ 18-1-24 (సూరసాని వారి ఆహ్వానము)