// Online C compiler to run C program online #include <stdio.h> void main() { struct book { int nop; char name; float price; }b; printf("\n enter name of the book:"); scanf("%c",& b.name ); printf("\n enter no of pages:"); scanf("%d",&b.nop); printf("\n enter PRICE OF book:"); scanf("%f",&b.price); printf("\n name of the book:%c", b.name ); printf("\n no of pages:%d",b.nop); printf("\n price:%f",b.price); } తెరమీద enter name of the book:z enter no of pages:786 enter PRICE OF book:20.5 name of the book:z no of pages:786 price:20.500000
#include <stdio.h> void main() { int p,numbered_packets[5],key,count=0; /*let there be some packets to be sent by Indian postal department which are numbered with some codes.After receiving them, we wish to search for a particular numbered packet becoz all packets might have got jumbled up */ for(p=0;p<5;p++) { printf("\n enter the code of numbered_packets[%d]:",p); scanf("%d",&numbered_packets[p]); } printf("\n enter the key code to be searched:"); scanf("%d",&key); for(p=0;p<5;p++) { if(numbered_packets[p]==key) { printf("\n packet with desired key found"); exit(0); } count=count+1; } if(count==5) printf("\n packet with desired key not found"); } ఔట్పుట్ తెరమీద enter the code of numbered_packets[0]:9 enter the code of numbered_packets[1]:7 enter the code of numbered_packets[2]:5 enter the co...
/*dedicated to student who asked genuine doubt and made me think*/ /*this program will create a file where only uppercase (A-Z) letters get written into the file. the content is later read and displayed on to the screen */ #include<stdio.h> #include<conio.h> void main() { char ch; FILE *fptr; fptr=fopen("nayA1601.txt","w"); printf("\n start entering the data: \n "); ch=getchar(); while(ch!='z') { if((ch>=65 &&ch<=92)) //only uppercase letters get written into file fputc(ch,fptr);// only this line is inside the if condition ch=getchar(); } fclose(fptr); printf("\n writing is over. lets read now:\n"); fptr=fopen("nayA1601.txt","r"); printf("\n\n start reading the data from the file: \n "); while(!feof(fptr)) { ch=fgetc(fptr); putchar(ch); } fclose(fptr); getch(); }
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.